diff --git a/ci-values-lang.yaml b/ci-values-lang.yaml index 7fb8a2f..0db37ef 100644 --- a/ci-values-lang.yaml +++ b/ci-values-lang.yaml @@ -69,6 +69,7 @@ configmap: VAR_A: VALUE_C VAR_B: VALUE_D saEnabled: false +customServiceAccountName: customServiceAccount keyVaults: bulk-scan: excludeEnvironmentSuffix: false @@ -198,7 +199,8 @@ java: configmap: VAR_A: VALUE_A VAR_B: VALUE_B - saEnabled: true + saEnabled: false + customServiceAccountName: customServiceAccount keyVaults: bulk-scan: excludeEnvironmentSuffix: false diff --git a/ci-values.yaml b/ci-values.yaml index d75ac47..74c4c60 100644 --- a/ci-values.yaml +++ b/ci-values.yaml @@ -70,7 +70,8 @@ environment: configmap: VAR_A: VALUE_A VAR_B: VALUE_B -saEnabled: true +saEnabled: false +customServiceAccountName: customServiceAccount envFromSecret: "env-secret" keyVaults: bulk-scan: diff --git a/library/templates/v2/_deployment.tpl b/library/templates/v2/_deployment.tpl index 2f8fc44..26b985a 100644 --- a/library/templates/v2/_deployment.tpl +++ b/library/templates/v2/_deployment.tpl @@ -12,7 +12,7 @@ spec: selector: matchLabels: app.kubernetes.io/name: {{ template "hmcts.releasename.v2" . }} -{{ include "hmcts.podtemplate.v5.tpl" . | indent 2 -}} +{{ include "hmcts.podtemplate.v6.tpl" . | indent 2 -}} {{- end -}} {{- define "hmcts.deployment.v5" -}} diff --git a/library/templates/v2/_podtemplate.tpl b/library/templates/v2/_podtemplate.tpl index f0f3b2a..30055e0 100644 --- a/library/templates/v2/_podtemplate.tpl +++ b/library/templates/v2/_podtemplate.tpl @@ -1,7 +1,7 @@ {{/* Create pod template spec. */}} -{{- define "hmcts.podtemplate.v5.tpl" -}} +{{- define "hmcts.podtemplate.v6.tpl" -}} {{- $languageValues := deepCopy .Values -}} {{- if hasKey .Values "language" -}} {{- $languageValues = (deepCopy .Values | merge (pluck .Values.language .Values | first) ) -}} @@ -14,9 +14,13 @@ template: {{- end }} {{- (include "hmcts.annotations.v2" .) | indent 4 }} spec: - {{- if $languageValues.saEnabled }} + + {{- if $languageValues.saEnabled}} serviceAccountName: {{ .Release.Namespace }} + {{ else if and (not $languageValues.saEnabled) ($languageValues.customServiceAccountName) }} + serviceAccountName: {{ $languageValues.customServiceAccountName }} {{- end }} + {{- include "hmcts.affinity.v1" . | indent 4 }} {{- if not $languageValues.runAsRoot }} securityContext: diff --git a/library/tests/snapshot-tests/__snapshot__/deployment_test.yaml.snap b/library/tests/snapshot-tests/__snapshot__/deployment_test.yaml.snap index 985cd3e..a684fec 100644 --- a/library/tests/snapshot-tests/__snapshot__/deployment_test.yaml.snap +++ b/library/tests/snapshot-tests/__snapshot__/deployment_test.yaml.snap @@ -126,7 +126,7 @@ manifest should match snapshot: securityContext: fsGroup: 1000 runAsUser: 1000 - serviceAccountName: NAMESPACE + serviceAccountName: customServiceAccount terminationGracePeriodSeconds: 30 tolerations: - effect: NoSchedule