diff --git a/pkg/features/list.go b/pkg/features/list.go index 942cb69e7cdc7..6aeaf328fdf24 100644 --- a/pkg/features/list.go +++ b/pkg/features/list.go @@ -127,10 +127,10 @@ var ( CustomizablePlatformComponents = registerFeature("Adds the ability to customize the regex rules for identifying platform components", "ROX_CUSTOMIZABLE_PLATFORM_COMPONENTS", enabled) // Provides only necessary configuration options for admission controller - AdmissionControllerConfig = registerFeature("Provides only necessary configuration options for admission controller", "ROX_ADMISSION_CONTROLLER_CONFIG") + AdmissionControllerConfig = registerFeature("Provides only necessary configuration options for admission controller", "ROX_ADMISSION_CONTROLLER_CONFIG", enabled) // Intgrate with LLM for risk recommendations - LLMRiskRecommendation = registerFeature("Intgrate with LLM for risk recommendations", "ROX_LLM_RISK_RECOMMENDATION") + LLMRiskRecommendation = registerFeature("Integrate with LLM for risk recommendations", "ROX_LLM_RISK_RECOMMENDATION") // Adds built-in policy to ensure that Red Hat images are signed by Red Hat Release Key RedHatImagesSignedPolicy = registerFeature("Adds built-in policy to ensure that Red Hat images are signed by the Red Hat release key", "ROX_RED_HAT_IMAGES_SIGNED_POLICY", unchangeableInProd) diff --git a/pkg/helm/charts/tests/securedclusterservices/feature-flags/feature_flags_test.go b/pkg/helm/charts/tests/securedclusterservices/feature-flags/feature_flags_test.go index 8e1ff87793dad..c92db0838535d 100644 --- a/pkg/helm/charts/tests/securedclusterservices/feature-flags/feature_flags_test.go +++ b/pkg/helm/charts/tests/securedclusterservices/feature-flags/feature_flags_test.go @@ -18,12 +18,20 @@ func TestWithDifferentFeatureFlags(t *testing.T) { testutils.SetVersion(t, testutils.GetExampleVersion(t)) testCases := map[string]struct { - featureFlags []string + featureFlags map[string]bool flavor defaults.ImageFlavor }{ "admission-controller-config": { - featureFlags: []string{"ROX_ADMISSION_CONTROLLER_CONFIG"}, - flavor: defaults.RHACSReleaseImageFlavor(), + featureFlags: map[string]bool{ + "ROX_ADMISSION_CONTROLLER_CONFIG": true, + }, + flavor: defaults.RHACSReleaseImageFlavor(), + }, + "admission-controller-config-disabled": { + featureFlags: map[string]bool{ + "ROX_ADMISSION_CONTROLLER_CONFIG": false, + }, + flavor: defaults.RHACSReleaseImageFlavor(), }, } @@ -36,8 +44,8 @@ func TestWithDifferentFeatureFlags(t *testing.T) { if values.FeatureFlags == nil { values.FeatureFlags = make(map[string]interface{}) } - for _, featureFlag := range testCaseSpec.featureFlags { - values.FeatureFlags[featureFlag] = true + for name, setting := range testCaseSpec.featureFlags { + values.FeatureFlags[name] = setting } }, HelmTestOpts: []helmTest.LoaderOpt{helmTest.WithAdditionalTestDirs(path.Join(testDir, testCaseName))}, diff --git a/pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config-disabled/admission-control.test.yaml b/pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config-disabled/admission-control.test.yaml new file mode 100644 index 0000000000000..6ed0db40b312a --- /dev/null +++ b/pkg/helm/charts/tests/securedclusterservices/feature-flags/testdata/helmtest/admission-controller-config-disabled/admission-control.test.yaml @@ -0,0 +1,38 @@ +values: + imagePullSecrets: + allowNone: true + monitoring: + openshift: + enabled: false +server: + availableSchemas: + - openshift-4.1.0 +tests: +- name: "Webhook timeout pads AdmissionController timeout by 2 seconds" + tests: + - name: "default AdmissionController timeout is 10s + 2s padding" + expect: | + .validatingwebhookconfigurations[].webhooks[].timeoutSeconds | assertThat(. == 10 + 2) + - name: "override sets value correctly" + values: + admissionControl: + dynamic: + timeout: 7 + expect: | + .validatingwebhookconfigurations[].webhooks[].timeoutSeconds | assertThat(. == 7 + 2) +- name: "OpenShift3 clusters do not support admission control sideEffects" + server: + availableSchemas: + - openshift-3.11.0 + set: + env.openshift: 3 + admissionControl: + listenOnEvents: true + listenOnCreates: true + listenOnUpdates: true + expectError: true +- name: "scanInline defaults to false" + set: + admissionControl.dynamic.scanInline: null + expect: | + .secrets["helm-cluster-config"].stringData["config.yaml"] | fromyaml | .clusterConfig.dynamicConfig.admissionControllerConfig | assertThat(.scanInline == false) diff --git a/pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml b/pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml index 706fa4a9421f3..fefd2092d5e4e 100644 --- a/pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml +++ b/pkg/helm/charts/tests/securedclusterservices/testdata/helmtest/admission-control.test.yaml @@ -8,18 +8,6 @@ server: availableSchemas: - openshift-4.1.0 tests: -- name: "OpenShift3 clusters do not support admission control sideEffects" - server: - availableSchemas: - - openshift-3.11.0 - set: - env.openshift: 3 - admissionControl: - listenOnEvents: true - listenOnCreates: true - listenOnUpdates: true - expectError: true - - name: "OpenShift4 clusters support admission control sideEffects" set: env.openshift: 4 @@ -63,19 +51,6 @@ tests: .validatingwebhookconfigurations[].apiVersion | assertThat(. == "admissionregistration.k8s.io/v1beta1") .validatingwebhookconfigurations[].webhooks[] | assertThat(.admissionReviewVersions == null) -- name: "Webhook timeout pads AdmissionController timeout by 2 seconds" - tests: - - name: "default AdmissionController timeout is 10s + 2s padding" - expect: | - .validatingwebhookconfigurations[].webhooks[].timeoutSeconds | assertThat(. == 10 + 2) - - name: "override sets value correctly" - values: - admissionControl: - dynamic: - timeout: 7 - expect: | - .validatingwebhookconfigurations[].webhooks[].timeoutSeconds | assertThat(. == 7 + 2) - - name: "Admission control deployment configuration" tests: - name: "default replicas" @@ -179,8 +154,3 @@ tests: failurePolicy: "Fail" expect: | .validatingwebhookconfigurations[].webhooks[].failurePolicy | assertThat(. == "Fail") -- name: "scanInline defaults to false" - set: - admissionControl.dynamic.scanInline: null - expect: | - .secrets["helm-cluster-config"].stringData["config.yaml"] | fromyaml | .clusterConfig.dynamicConfig.admissionControllerConfig | assertThat(.scanInline == false) diff --git a/qa-tests-backend/src/test/groovy/Enforcement.groovy b/qa-tests-backend/src/test/groovy/Enforcement.groovy index bbff411ca9825..d342236e8c472 100644 --- a/qa-tests-backend/src/test/groovy/Enforcement.groovy +++ b/qa-tests-backend/src/test/groovy/Enforcement.groovy @@ -250,6 +250,8 @@ class Enforcement extends BaseSpecification { .build() assert ClusterService.updateAdmissionController(ac) + // Sleep to allow settings update to propagate + sleep(5000) POLICIES.each { label, create ->