From a03eb6d73a45321eebfdab2922e46098cd12311f Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 5 Mar 2024 10:28:37 +0100 Subject: [PATCH] set pod securitycontext --- src/main/helm/templates/deployment.yaml | 6 ++---- .../helm/deployment_container_security_context_test.yaml | 2 +- .../src/main/helm/templates/xta_adapter_cronjob.yaml | 8 +++----- .../src/test/helm/xta_adapter_cronjob_basic_test.yaml | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 25aac6555..700bdd9fb 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -167,10 +167,8 @@ spec: {{ toYaml . | indent 8 }} {{- end }} schedulerName: default-scheduler - {{- if (.Values.securityContext).fsGroup }} + {{- with .Values.podSecurityContext }} securityContext: - fsGroup: {{ (.Values.securityContext).fsGroup }} - {{- else }} - securityContext: {} +{{ toYaml . | indent 8 }} {{- end }} terminationGracePeriodSeconds: 30 \ No newline at end of file diff --git a/src/test/helm/deployment_container_security_context_test.yaml b/src/test/helm/deployment_container_security_context_test.yaml index f8679c7fd..ddaa3ee20 100644 --- a/src/test/helm/deployment_container_security_context_test.yaml +++ b/src/test/helm/deployment_container_security_context_test.yaml @@ -71,7 +71,7 @@ tests: value: 1000 - it: check fsGroup set: - securityContext.fsGroup: 1000 + podSecurityContext.fsGroup: 1000 asserts: - equal: path: spec.template.spec.securityContext.fsGroup diff --git a/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml b/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml index 04e62c964..1523ad46d 100644 --- a/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml +++ b/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml @@ -168,9 +168,7 @@ spec: {{ else }} - name: {{ .Release.Name }}-image-pull-secret {{- end }} - {{- if (.Values.securityContext).fsGroup }} + {{- with .Values.podSecurityContext }} securityContext: - fsGroup: {{ (.Values.securityContext).fsGroup }} - {{- else }} - securityContext: {} - {{- end }} +{{ toYaml . | indent 12 }} + {{- end }} \ No newline at end of file diff --git a/xta-adapter/src/test/helm/xta_adapter_cronjob_basic_test.yaml b/xta-adapter/src/test/helm/xta_adapter_cronjob_basic_test.yaml index c42c4aadc..b17ff7452 100644 --- a/xta-adapter/src/test/helm/xta_adapter_cronjob_basic_test.yaml +++ b/xta-adapter/src/test/helm/xta_adapter_cronjob_basic_test.yaml @@ -133,7 +133,7 @@ tests: workload: xta-adapter-cronjob - it: check fsGroup set: - securityContext.fsGroup: 1000 + podSecurityContext.fsGroup: 1000 asserts: - equal: path: spec.jobTemplate.spec.template.spec.securityContext.fsGroup -- GitLab