From 5d5a7546652f9ed702507a71fafe1d44090eb45f Mon Sep 17 00:00:00 2001 From: "v.oleynikov" Date: Sun, 8 Nov 2026 19:37:32 +0300 Subject: [PATCH] fix(spe): render SecurityPolicyExceptions only when the CRD exists The admission-policy-engine-crd entry in global.enabledModules is not a proof that the SecurityPolicyException API is served: addon-operator adds -crd for every enabled module that ships CRDs, so the entry is present on releases whose admission-policy-engine has no such CRD. Modules using the lib-helm SecurityPolicyException templates then fail to install with "no matches for kind SecurityPolicyException". Gate the SecurityPolicyException object and the pod label that refers to it in the CAPI, cloud controller manager, CSI controller and CSI node templates on the GVK alone through helm_lib_api_version_exists, instead of the admission-policy-engine-crd entry. The label tests asserted spec.selector.matchLabels, where the label is never set, so the negative cases passed regardless of the guard; they now check the pod template labels. Signed-off-by: v.oleynikov --- charts/helm_lib/Chart.yaml | 2 +- .../templates/_capi_controller_manager.tpl | 2 +- .../templates/_cloud_controller_manager.tpl | 4 +- charts/helm_lib/templates/_csi_controller.tpl | 4 +- charts/helm_lib/templates/_csi_node.tpl | 4 +- ...helm_lib_capi_controller_manager_test.yaml | 37 +++++- ...elm_lib_cloud_controller_manager_test.yaml | 52 ++++++++- .../helm_lib_csi_controller_spe_test.yaml | 110 +++++++++++++++++- tests/tests/helm_lib_csi_node_spe_test.yaml | 97 ++++++++++++++- 9 files changed, 295 insertions(+), 17 deletions(-) diff --git a/charts/helm_lib/Chart.yaml b/charts/helm_lib/Chart.yaml index ac49645..8137575 100644 --- a/charts/helm_lib/Chart.yaml +++ b/charts/helm_lib/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 type: library name: deckhouse_lib_helm -version: 1.72.34 +version: 1.72.35 description: "Helm utils template definitions for Deckhouse modules." diff --git a/charts/helm_lib/templates/_capi_controller_manager.tpl b/charts/helm_lib/templates/_capi_controller_manager.tpl index 477ee7b..b990785 100644 --- a/charts/helm_lib/templates/_capi_controller_manager.tpl +++ b/charts/helm_lib/templates/_capi_controller_manager.tpl @@ -220,7 +220,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} -{{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} +{{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} {{- if $hostNetwork }} --- apiVersion: deckhouse.io/v1alpha1 diff --git a/charts/helm_lib/templates/_cloud_controller_manager.tpl b/charts/helm_lib/templates/_cloud_controller_manager.tpl index 6cf2699..8d363de 100644 --- a/charts/helm_lib/templates/_cloud_controller_manager.tpl +++ b/charts/helm_lib/templates/_cloud_controller_manager.tpl @@ -147,7 +147,7 @@ spec: metadata: labels: app: {{ $fullname }} - {{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} + {{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} security.deckhouse.io/security-policy-exception: {{ $fullname }} {{- end }} {{- with $additionalPodLabels }} @@ -221,7 +221,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} -{{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} +{{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} --- apiVersion: deckhouse.io/v1alpha1 kind: SecurityPolicyException diff --git a/charts/helm_lib/templates/_csi_controller.tpl b/charts/helm_lib/templates/_csi_controller.tpl index 4a2fc50..1570442 100644 --- a/charts/helm_lib/templates/_csi_controller.tpl +++ b/charts/helm_lib/templates/_csi_controller.tpl @@ -259,7 +259,7 @@ spec: metadata: labels: app: {{ $fullname }} - {{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} + {{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} security.deckhouse.io/security-policy-exception: {{ $fullname }} {{- end }} {{- if or (hasPrefix "cloud-provider-" $context.Chart.Name) ($additionalCsiControllerPodAnnotations) }} @@ -570,7 +570,7 @@ spec: {{- $additionalControllerVolumes | toYaml | nindent 6 }} {{- end }} -{{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} +{{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} {{- $controllerContainer := dict "name" "controller" "securityContext" (dict "allowPrivilegeEscalation" false) "ports" ($additionalControllerPorts | default list) }} {{- $relaxations := include "helm_lib_csi_spe_container_relaxations" (list (concat (list $controllerContainer) ($additionalContainers | default list) ($initContainers | default list)) (eq $csiControllerHostNetwork "true")) | fromYaml }} {{- $privileged := or $forceCsiControllerPrivilegedContainer (gt (len $relaxations.privileged) 0) }} diff --git a/charts/helm_lib/templates/_csi_node.tpl b/charts/helm_lib/templates/_csi_node.tpl index 3c9d746..d671e28 100644 --- a/charts/helm_lib/templates/_csi_node.tpl +++ b/charts/helm_lib/templates/_csi_node.tpl @@ -101,7 +101,7 @@ spec: metadata: labels: app: {{ $fullname }} - {{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} + {{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} security.deckhouse.io/security-policy-exception: {{ $fullname }} {{- end }} {{- if or (hasPrefix "cloud-provider-" $context.Chart.Name) ($additionalCsiNodePodAnnotations) }} @@ -307,7 +307,7 @@ spec: {{- $additionalNodeVolumes | toYaml | nindent 6 }} {{- end }} -{{- if and $securityPolicyExceptionEnabled ($context.Values.global.enabledModules | has "admission-policy-engine-crd") }} +{{- if and $securityPolicyExceptionEnabled (include "helm_lib_api_version_exists" (list $context "deckhouse.io/v1alpha1/SecurityPolicyException")) }} {{- $relaxations := include "helm_lib_csi_spe_container_relaxations" (list (concat ($additionalContainers | default list) ($initContainers | default list)) (eq $csiNodeHostNetwork "true")) | fromYaml }} {{- $capabilityValues := $relaxations.capabilityValues }} {{- if $setSysAdminCapability }} diff --git a/tests/tests/helm_lib_capi_controller_manager_test.yaml b/tests/tests/helm_lib_capi_controller_manager_test.yaml index 092fa3a..168c253 100644 --- a/tests/tests/helm_lib_capi_controller_manager_test.yaml +++ b/tests/tests/helm_lib_capi_controller_manager_test.yaml @@ -761,6 +761,8 @@ tests: enabledModules: - admission-policy-engine-crd discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: fullname: capz-controller-manager @@ -774,12 +776,37 @@ tests: kind: SecurityPolicyException apiVersion: deckhouse.io/v1alpha1 - - it: does not render SecurityPolicyException when admission-policy-engine-crd module is not enabled + - it: renders SecurityPolicyException when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: placement: {} enabledModules: [] + discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException + d8SpecificNodeCountByRole: {} + _testvalues: + fullname: capz-controller-manager + image: controllerImage + capiProviderName: infrastructure-zvirt + securityPolicyExceptionEnabled: true + hostNetwork: true + documentSelector: + path: kind + value: SecurityPolicyException + asserts: + - containsDocument: + kind: SecurityPolicyException + apiVersion: deckhouse.io/v1alpha1 + + - it: does not render SecurityPolicyException when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd discovery: d8SpecificNodeCountByRole: {} _testvalues: @@ -802,6 +829,8 @@ tests: enabledModules: - admission-policy-engine-crd discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: fullname: capz-controller-manager @@ -825,6 +854,8 @@ tests: enabledModules: - admission-policy-engine-crd discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: fullname: capcd-controller-manager @@ -873,6 +904,8 @@ tests: enabledModules: - admission-policy-engine-crd discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: fullname: capcd-controller-manager @@ -909,6 +942,8 @@ tests: enabledModules: - admission-policy-engine-crd discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: fullname: capcd-controller-manager diff --git a/tests/tests/helm_lib_cloud_controller_manager_test.yaml b/tests/tests/helm_lib_cloud_controller_manager_test.yaml index 96986f8..2032643 100644 --- a/tests/tests/helm_lib_cloud_controller_manager_test.yaml +++ b/tests/tests/helm_lib_cloud_controller_manager_test.yaml @@ -577,6 +577,8 @@ tests: - admission-policy-engine-crd clusterIsBootstrapped: true discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: image: controllerImage @@ -609,6 +611,8 @@ tests: - admission-policy-engine-crd clusterIsBootstrapped: true discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: image: controllerImage @@ -651,7 +655,7 @@ tests: path: spec.volumes.hostPath.allowedValues[0].readOnly value: true - - it: does not render SecurityPolicyException when admission policy module is disabled + - it: renders SecurityPolicyException when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: @@ -659,6 +663,8 @@ tests: enabledModules: [] clusterIsBootstrapped: true discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException d8SpecificNodeCountByRole: {} _testvalues: image: controllerImage @@ -670,4 +676,46 @@ tests: type: DirectoryOrCreate asserts: - hasDocuments: - count: 2 \ No newline at end of file + count: 3 + + - it: does not render SecurityPolicyException when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd + clusterIsBootstrapped: true + discovery: + d8SpecificNodeCountByRole: {} + _testvalues: + image: controllerImage + securityPolicyExceptionEnabled: true + additionalVolumes: + - name: k8s-certs + hostPath: + path: /etc/kubernetes/pki + type: DirectoryOrCreate + asserts: + - hasDocuments: + count: 2 + + - it: does not add pod metadata marker when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd + clusterIsBootstrapped: true + discovery: + d8SpecificNodeCountByRole: {} + _testvalues: + image: controllerImage + securityPolicyExceptionEnabled: true + documentSelector: + path: kind + value: Deployment + asserts: + - notExists: + path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] diff --git a/tests/tests/helm_lib_csi_controller_spe_test.yaml b/tests/tests/helm_lib_csi_controller_spe_test.yaml index b34525a..76911e4 100644 --- a/tests/tests/helm_lib_csi_controller_spe_test.yaml +++ b/tests/tests/helm_lib_csi_controller_spe_test.yaml @@ -20,6 +20,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -31,12 +33,46 @@ tests: kind: SecurityPolicyException apiVersion: deckhouse.io/v1alpha1 - - it: does not render SecurityPolicyException when admission-policy-engine-crd module is not enabled + - it: renders SecurityPolicyException when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: placement: {} enabledModules: [] + modulesImages: + registry: + base: "deckhouse.io/deckhouse/ce" + digests: + common: + csiExternalAttacher125: csiControllerAttacher125 + csiExternalProvisioner125: csiControllerProvisioner125 + csiExternalResizer125: csiControllerResizer125 + csiExternalSnapshotter125: csiControllerSnapshotter125 + csiLivenessprobe125: csiLivenessProbe125 + discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException + kubernetesVersion: "1.25" + d8SpecificNodeCountByRole: {} + _testvalues: + controllerImage: controllerImage + securityPolicyExceptionEnabled: true + csiControllerHostNetwork: "true" + documentSelector: + path: kind + value: SecurityPolicyException + asserts: + - containsDocument: + kind: SecurityPolicyException + apiVersion: deckhouse.io/v1alpha1 + + - it: does not render SecurityPolicyException when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd modulesImages: registry: base: "deckhouse.io/deckhouse/ce" @@ -106,6 +142,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -116,14 +154,46 @@ tests: value: Deployment asserts: - notExists: - path: spec.selector.matchLabels["security.deckhouse.io/security-policy-exception"] + path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] - - it: does not add security-policy-exception label when admission-policy-engine-crd is not enabled + - it: adds security-policy-exception label when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: placement: {} enabledModules: [] + modulesImages: + registry: + base: "deckhouse.io/deckhouse/ce" + digests: + common: + csiExternalAttacher125: csiControllerAttacher125 + csiExternalProvisioner125: csiControllerProvisioner125 + csiExternalResizer125: csiControllerResizer125 + csiExternalSnapshotter125: csiControllerSnapshotter125 + csiLivenessprobe125: csiLivenessProbe125 + discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException + kubernetesVersion: "1.25" + d8SpecificNodeCountByRole: {} + _testvalues: + controllerImage: controllerImage + securityPolicyExceptionEnabled: true + documentSelector: + path: kind + value: Deployment + asserts: + - exists: + path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] + + - it: does not add security-policy-exception label when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd modulesImages: registry: base: "deckhouse.io/deckhouse/ce" @@ -145,7 +215,7 @@ tests: value: Deployment asserts: - notExists: - path: spec.selector.matchLabels["security.deckhouse.io/security-policy-exception"] + path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] - it: adds security-policy-exception label to Deployment pod template set: @@ -165,6 +235,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -197,6 +269,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -246,6 +320,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -286,6 +362,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -326,6 +404,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -378,6 +458,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -417,6 +499,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -453,6 +537,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -506,6 +592,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -557,6 +645,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -592,6 +682,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -650,6 +742,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -683,6 +777,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -720,6 +816,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -790,6 +888,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -833,6 +933,8 @@ tests: csiExternalSnapshotter125: csiControllerSnapshotter125 csiLivenessprobe125: csiLivenessProbe125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: diff --git a/tests/tests/helm_lib_csi_node_spe_test.yaml b/tests/tests/helm_lib_csi_node_spe_test.yaml index e752f46..9cef1fe 100644 --- a/tests/tests/helm_lib_csi_node_spe_test.yaml +++ b/tests/tests/helm_lib_csi_node_spe_test.yaml @@ -16,6 +16,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -29,12 +31,43 @@ tests: kind: SecurityPolicyException apiVersion: deckhouse.io/v1alpha1 - - it: does not render SecurityPolicyException when admission-policy-engine-crd module is not enabled + - it: renders SecurityPolicyException when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: placement: {} enabledModules: [] + modulesImages: + registry: + base: "deckhouse.io/deckhouse/ce" + digests: + common: + csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 + discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException + kubernetesVersion: "1.25" + d8SpecificNodeCountByRole: {} + _testvalues: + nodeImage: nodeImage + driverFQDN: test.csi.example.com + securityPolicyExceptionEnabled: true + forceCsiNodeAndStaticNodesDepoloy: true + documentSelector: + path: kind + value: SecurityPolicyException + asserts: + - containsDocument: + kind: SecurityPolicyException + apiVersion: deckhouse.io/v1alpha1 + + - it: does not render SecurityPolicyException when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd modulesImages: registry: base: "deckhouse.io/deckhouse/ce" @@ -95,6 +128,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -109,12 +144,42 @@ tests: - notExists: path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] - - it: does not add security-policy-exception label when admission-policy-engine-crd is not enabled + - it: adds security-policy-exception label when the SecurityPolicyException API exists although admission-policy-engine-crd is not enabled set: global: modules: placement: {} enabledModules: [] + modulesImages: + registry: + base: "deckhouse.io/deckhouse/ce" + digests: + common: + csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 + discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException + kubernetesVersion: "1.25" + d8SpecificNodeCountByRole: {} + _testvalues: + nodeImage: nodeImage + driverFQDN: test.csi.example.com + securityPolicyExceptionEnabled: true + forceCsiNodeAndStaticNodesDepoloy: true + documentSelector: + path: kind + value: DaemonSet + asserts: + - exists: + path: spec.template.metadata.labels["security.deckhouse.io/security-policy-exception"] + + - it: does not add security-policy-exception label when the SecurityPolicyException API is missing although admission-policy-engine-crd is enabled + set: + global: + modules: + placement: {} + enabledModules: + - admission-policy-engine-crd modulesImages: registry: base: "deckhouse.io/deckhouse/ce" @@ -150,6 +215,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -179,6 +246,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -264,6 +333,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -300,6 +371,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -332,6 +405,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -366,6 +441,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -399,6 +476,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -429,6 +508,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -476,6 +557,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -521,6 +604,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -556,6 +641,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -613,6 +700,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -678,6 +767,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: @@ -712,6 +803,8 @@ tests: common: csiNodeDriverRegistrar125: csiNodeDriverRegistrar125 discovery: + apiVersions: + - deckhouse.io/v1alpha1/SecurityPolicyException kubernetesVersion: "1.25" d8SpecificNodeCountByRole: {} _testvalues: