1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

Merge pull request #860 from knelasevero/migrate-node-afinity-to-plugin

Migrate RemovePodsViolatingNodeAffinity to plugin
This commit is contained in:
Kubernetes Prow Robot
2022-08-09 06:14:51 -07:00
committed by GitHub
8 changed files with 282 additions and 176 deletions

View File

@@ -65,3 +65,17 @@ func validateLabelSelectorArgs(labelSelector *metav1.LabelSelector) error {
return nil
}
// ValidateRemovePodsViolatingNodeAffinityArgs validates RemovePodsViolatingNodeAffinity arguments
func ValidateRemovePodsViolatingNodeAffinityArgs(args *componentconfig.RemovePodsViolatingNodeAffinityArgs) error {
if args == nil || len(args.NodeAffinityType) == 0 {
return fmt.Errorf("nodeAffinityType needs to be set")
}
// At most one of include/exclude can be set
if args.Namespaces != nil && len(args.Namespaces.Include) > 0 && len(args.Namespaces.Exclude) > 0 {
return fmt.Errorf("only one of Include/Exclude namespaces can be set")
}
return nil
}