4545 {{- if .Values.podSecurityContext.enabled }}
4646 securityContext : {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
4747 {{- end }}
48- {{- if .Values.initContainers }}
48+ {{- if or (and .Values.postgresInit.enabled .Values.persistence.enabled) (and .Values.keygen.enabled .Values.persistence.enabled) .Values.initContainers }}
4949 initContainers :
50+ {{- if and .Values.postgresInit.enabled .Values.persistence.enabled }}
51+ - name : postgres-init
52+ image : {{ include "common.images.image" (dict "imageRoot" .Values.postgresInit.image "global" .Values.global) }}
53+ imagePullPolicy : {{ .Values.postgresInit.image.pullPolicy }}
54+ {{- include "keymanager.postgresInit.command" . | nindent 10 }}
55+ {{- if .Values.postgresInit.containerSecurityContext.enabled }}
56+ securityContext : {{- omit .Values.postgresInit.containerSecurityContext "enabled" | toYaml | nindent 12 }}
57+ {{- end }}
58+ env :
59+ {{- include "keymanager.postgresInit.envVars" . | nindent 12 }}
60+ volumeMounts :
61+ {{- if and .Values.postgresInit.startUpCommand (not (or .Values.postgresInit.command .Values.postgresInit.args)) }}
62+ - name : postgres-init-conf
63+ mountPath : /startup.sh
64+ subPath : startup-command-sh
65+ {{- end }}
66+ {{- if .Values.postgresInit.keyPolicyDef.enabled }}
67+ - name : postgres-init-conf
68+ mountPath : {{ include "common.tplvalues.render" (dict "value" .Values.postgresInit.keyPolicyDef.mountPath "context" $) }}
69+ subPath : key-policy-def-csv
70+ {{- end }}
71+ - name : keymanager-data
72+ mountPath : {{ .Values.persistence.mountPath }}
73+ {{- if .Values.postgresInit.extraVolumeMounts }}
74+ {{- include "common.tplvalues.render" (dict "value" .Values.postgresInit.extraVolumeMounts "context" $) | nindent 12 }}
75+ {{- end }}
76+ {{- end }}
77+ {{- if and .Values.keygen.enabled .Values.persistence.enabled }}
78+ - name : keygen
79+ image : {{ include "common.images.image" (dict "imageRoot" .Values.keygen.image "global" .Values.global) }}
80+ imagePullPolicy : {{ .Values.keygen.image.pullPolicy }}
81+ {{- include "keymanager.keygen.command" . | nindent 10 }}
82+ {{- if .Values.keygen.containerSecurityContext.enabled }}
83+ securityContext : {{- omit .Values.keygen.containerSecurityContext "enabled" | toYaml | nindent 12 }}
84+ {{- end }}
85+ env :
86+ {{- include "keymanager.keygen.envVars" . | nindent 12 }}
87+ volumeMounts :
88+ {{- if and .Values.keygen.startUpCommand (not (or .Values.keygen.command .Values.keygen.args)) }}
89+ - name : keygen-conf
90+ mountPath : /startup.sh
91+ subPath : startup-command-sh
92+ {{- end }}
93+ {{- if and .Values.springConfig.rawConfig (not .Values.springConfig.gitRepo.enabled) }}
94+ - name : spring-config
95+ mountPath : {{ include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfigMountPath "context" $) }}
96+ subPath : application.properties
97+ {{- end }}
98+ - name : keymanager-data
99+ mountPath : {{ .Values.persistence.mountPath }}
100+ {{- if .Values.keygen.extraVolumeMounts }}
101+ {{- include "common.tplvalues.render" (dict "value" .Values.keygen.extraVolumeMounts "context" $) | nindent 12 }}
102+ {{- end }}
103+ {{- end }}
104+ {{- if .Values.initContainers }}
50105 {{- include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 8 }}
106+ {{- end }}
51107 {{- end }}
52108 containers :
53109 - name : keymanager
@@ -94,6 +150,10 @@ spec:
94150 mountPath : {{ include "common.tplvalues.render" (dict "value" .Values.springConfig.rawConfigMountPath "context" $) }}
95151 subPath : application.properties
96152 {{- end }}
153+ {{- if .Values.persistence.enabled }}
154+ - name : keymanager-data
155+ mountPath : {{ .Values.persistence.mountPath }}
156+ {{- end }}
97157 {{- if .Values.extraVolumeMounts }}
98158 {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
99159 {{- end }}
@@ -112,6 +172,23 @@ spec:
112172 configMap :
113173 name : {{ template "common.names.fullname" . }}-spring-config
114174 {{- end }}
175+ {{- if .Values.persistence.enabled }}
176+ {{- if or .Values.postgresInit.keyPolicyDef.enabled (and .Values.postgresInit.startUpCommand (not (or .Values.postgresInit.command .Values.postgresInit.args))) }}
177+ - name : postgres-init-conf
178+ configMap :
179+ name : {{ include "common.names.fullname" . }}-postgres-init
180+ defaultMode : 0755
181+ {{- end }}
182+ {{- if and .Values.keygen.startUpCommand (not (or .Values.keygen.command .Values.keygen.args)) }}
183+ - name : keygen-conf
184+ configMap :
185+ name : {{ include "common.names.fullname" . }}-keygen
186+ defaultMode : 0755
187+ {{- end }}
188+ - name : keymanager-data
189+ persistentVolumeClaim :
190+ claimName : {{ (tpl .Values.persistence.existingClaim $) | default (include "common.names.fullname" .) }}
191+ {{- end }}
115192 {{- if .Values.extraVolumes }}
116193 {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
117194 {{- end }}
0 commit comments