From 9cdf9ee36649dee8ae3f29c0ce411cdd3e034463 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 28 Jan 2022 17:11:51 -0600 Subject: [PATCH] implement ignored labels for region --- pkg/apis/provisioning/v1alpha5/constraints.go | 3 +++ pkg/apis/provisioning/v1alpha5/requirements.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/pkg/apis/provisioning/v1alpha5/constraints.go b/pkg/apis/provisioning/v1alpha5/constraints.go index aae139ad6fda..1427e02b9ca2 100644 --- a/pkg/apis/provisioning/v1alpha5/constraints.go +++ b/pkg/apis/provisioning/v1alpha5/constraints.go @@ -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()) } diff --git a/pkg/apis/provisioning/v1alpha5/requirements.go b/pkg/apis/provisioning/v1alpha5/requirements.go index e0c384c121e4..984331515ce4 100644 --- a/pkg/apis/provisioning/v1alpha5/requirements.go +++ b/pkg/apis/provisioning/v1alpha5/requirements.go @@ -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