Graduate PodAffinityNamespaceSelector to GA

This commit is contained in:
Abdullah Gharaibeh
2022-02-15 13:08:48 -05:00
parent 2355747e7c
commit 8a1c70b48c
30 changed files with 138 additions and 591 deletions

View File

@@ -4933,7 +4933,7 @@ func TestValidateResourceQuotaWithAlphaLocalStorageCapacityIsolation(t *testing.
Spec: spec,
}
if errs := ValidateResourceQuota(resourceQuota, ResourceQuotaValidationOptions{}); len(errs) != 0 {
if errs := ValidateResourceQuota(resourceQuota); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
@@ -16212,10 +16212,9 @@ func TestValidateResourceQuota(t *testing.T) {
}
testCases := map[string]struct {
rq core.ResourceQuota
errDetail string
errField string
disableNamespaceSelector bool
rq core.ResourceQuota
errDetail string
errField string
}{
"no-scope": {
rq: core.ResourceQuota{
@@ -16333,17 +16332,10 @@ func TestValidateResourceQuota(t *testing.T) {
rq: core.ResourceQuota{ObjectMeta: metav1.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: invalidCrossNamespaceAffinitySpec},
errDetail: "must be 'Exist' when scope is any of ResourceQuotaScopeTerminating, ResourceQuotaScopeNotTerminating, ResourceQuotaScopeBestEffort, ResourceQuotaScopeNotBestEffort or ResourceQuotaScopeCrossNamespacePodAffinity",
},
"cross-namespace-affinity-disabled": {
rq: core.ResourceQuota{ObjectMeta: metav1.ObjectMeta{Name: "abc", Namespace: "foo"}, Spec: crossNamespaceAffinitySpec},
errDetail: "unsupported scope",
disableNamespaceSelector: true,
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
errs := ValidateResourceQuota(&tc.rq, ResourceQuotaValidationOptions{
AllowPodAffinityNamespaceSelector: !tc.disableNamespaceSelector,
})
errs := ValidateResourceQuota(&tc.rq)
if len(tc.errDetail) == 0 && len(tc.errField) == 0 && len(errs) != 0 {
t.Errorf("expected success: %v", errs)
} else if (len(tc.errDetail) != 0 || len(tc.errField) != 0) && len(errs) == 0 {