Change:
return utilerrors.NewAggregate(validationErrors) } <ins> // validatePriorityRedeclared checks if any custom priorities have been declared multiple times in the policy config // by examining the specified priority arguments func validatePriorityRedeclared(priorities map[string]schedulerapi.PriorityPolicy, priority schedulerapi.PriorityPolicy) error { var priorityType string if priority.Argument != nil { if priority.Argument.LabelPreference != nil { priorityType = "LabelPreference" } else if priority.Argument.RequestedToCapacityRatioArguments != nil { priorityType = "RequestedToCapacityRatioArguments" } else if priority.Argument.ServiceAntiAffinity != nil { priorityType = "ServiceAntiAffinity" } else { return fmt.Errorf("No priority arguments set for priority %s", priority.Name) } if existing, alreadyDeclared := priorities[priorityType]; alreadyDeclared { return fmt.Errorf("Priority '%s' redeclares custom priority '%s', from:'%s'", priority.Name, priorityType, existing.Name) } priorities[priorityType] = priority } return nil } // validatePredicateRedeclared checks if any custom predicates have been declared multiple times in the policy config // by examining the specified predicate arguments func validatePredicateRedeclared(predicates map[string]schedulerapi.PredicatePolicy, predicate schedulerapi.PredicatePolicy) error { var predicateType string if predicate.Argument != nil { if predicate.Argument.LabelsPresence != nil { predicateType = "LabelsPresence" } else if predicate.Argument.ServiceAffinity != nil { predicateType = "ServiceAffinity" } else { return fmt.Errorf("No priority arguments set for priority %s", predicate.Name) } if existing, alreadyDeclared := predicates[predicateType]; alreadyDeclared { return fmt.Errorf("Predicate '%s' redeclares custom predicate '%s', from:'%s'", predicate.Name, predicateType, existing.Name) } predicates[predicateType] = predicate } return nil } </ins> // validateExtendedResourceName checks whether the specified name is a valid // extended resource name. func validateExtendedResourceName(name v1.ResourceName) []error {

Discussion:
Currently custom predicate and priorities can be created through the . The problem is that a custom predicate/priority, like ServiceAffinity, can be multiple times in the Policy with different names, possibly with different arguments. This semantic (i.e., specifying multiple instances of the same custom predicate with different arguments) is only useful if different s were specified because in all cases of custom predicates/priorities the arguments are merge-able (for example, from multiple CheckServiceAffinity custom predicates can be merged into one set). In the world of framework plugins, we don't currently have a way to maintain those semantics. to run. The question here: do we really want to maintain the old semantics of custom predicates and priorities? in other words, do we need to change the ComponentConfig API to somehow allow specifying multiple instances of the same Plugin with different arguments/weights, or should we consider that this is not supported? I always lean towards simplifying things, so my suggestion is to not support that, but I would like to know if there are actual deployments that rely on this. /sig scheduling /cc
/cc
We discussed this in the sig meeting, and put the issue for discussion on the scheduler and kubernetes-dev mailing list, I believe this behavior is not intentional, and so we should add logic to fail the scheduler configuration when a policy includes more than one custom predicate/priority of the same type. /assign
/assign
any progress on this one?
I haven't made any progress on this yet, but it's on my priority now
In migrating custom predicates to filter plugins , I am gonna ignore the custom predicate name and use the default name.