Skip to content

Commit

Permalink
Adding new customServiceAccountName input to podTemplate (#122)
Browse files Browse the repository at this point in the history
* Adding new customServiceAccountName input to podTemplate, updating version of podTemplate and adding new inputs to values.yaml. Tests updated to suit

* Updating deployment template with latest version of podtemplate
  • Loading branch information
MartyFox authored Jun 13, 2024
1 parent d446fa5 commit 48a0176
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion ci-values-lang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ configmap:
VAR_A: VALUE_C
VAR_B: VALUE_D
saEnabled: false
customServiceAccountName: customServiceAccount
keyVaults:
bulk-scan:
excludeEnvironmentSuffix: false
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ci-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion library/templates/v2/_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" -}}
Expand Down
8 changes: 6 additions & 2 deletions library/templates/v2/_podtemplate.tpl
Original file line number Diff line number Diff line change
@@ -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) ) -}}
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ manifest should match snapshot:
securityContext:
fsGroup: 1000
runAsUser: 1000
serviceAccountName: NAMESPACE
serviceAccountName: customServiceAccount
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoSchedule
Expand Down

0 comments on commit 48a0176

Please sign in to comment.