Skip to content

Commit

Permalink
implement ignored labels for region
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Jan 28, 2022
1 parent f345a6c commit 9cdf9ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/apis/provisioning/v1alpha5/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func (c *Constraints) ValidatePod(pod *v1.Pod) error {
// The constraints do not support this requirement
podRequirements := PodRequirements(pod)
for _, key := range podRequirements.Keys() {
if IgnoredLabels.Has(key) {
continue
}
if c.Requirements.Requirement(key).Len() == 0 {
return fmt.Errorf("invalid nodeSelector %q, %v not in %v", key, podRequirements.Requirement(key).UnsortedList(), c.Requirements.Requirement(key).UnsortedList())
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/provisioning/v1alpha5/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ var (
"beta.kubernetes.io/os": v1.LabelOSStable,
v1.LabelInstanceType: v1.LabelInstanceTypeStable,
}
// IgnoredLables are not considered in scheduling decisions
// and prevent validation errors when specified
IgnoredLabels = sets.NewString(
v1.LabelTopologyRegion,
)
)

// Requirements is a decorated alias type for []v1.NodeSelectorRequirements
Expand Down

0 comments on commit 9cdf9ee

Please sign in to comment.