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

Migrate RemovePodsViolatingNodeAffinity into a plugin

This commit is contained in:
Lucas Severo Alves
2022-08-04 19:05:03 +02:00
parent d109ea64d0
commit 0c3bf7f957
8 changed files with 282 additions and 176 deletions

View File

@@ -48,3 +48,17 @@ func validateCommonArgs(namespaces *api.Namespaces, labelSelector *metav1.LabelS
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
}