Skip to content

Commit a3f5dbf

Browse files
committed
putting secrets in build.sh instead of using patch on charts
This commit aims to simplify the process of managing secrets in the build process by removing the patching of charts and instead directly including the secrets in the build.sh script. Issue: ZENKO-4982
1 parent e69b9a0 commit a3f5dbf

File tree

5 files changed

+19
-71
lines changed

5 files changed

+19
-71
lines changed

solution-base/build.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,25 @@ function render_mongodb_sharded_yamls()
121121
--set configsvr.serviceAccount.create=false \
122122
--set mongos.serviceAccount.create=false \
123123
--set shardsvr.dataNode.serviceAccount.create=false \
124-
--set shardsvr.arbiter.serviceAccount.create=false
124+
--set shardsvr.arbiter.serviceAccount.create=false \
125+
--set 'configsvr.extraEnvVars[0].name=MONGODB_APP_USERNAME' \
126+
--set 'configsvr.extraEnvVars[0].valueFrom.secretKeyRef.name=mongodb-db-creds' \
127+
--set 'configsvr.extraEnvVars[0].valueFrom.secretKeyRef.key=mongodb-username' \
128+
--set 'configsvr.extraEnvVars[1].name=MONGODB_APP_DATABASE' \
129+
--set 'configsvr.extraEnvVars[1].valueFrom.secretKeyRef.name=mongodb-db-creds' \
130+
--set 'configsvr.extraEnvVars[1].valueFrom.secretKeyRef.key=mongodb-database' \
131+
--set 'configsvr.extraEnvVars[2].name=MONGODB_APP_PASSWORD' \
132+
--set 'configsvr.extraEnvVars[2].valueFrom.secretKeyRef.name=mongodb-db-creds' \
133+
--set 'configsvr.extraEnvVars[2].valueFrom.secretKeyRef.key=mongodb-password' \
134+
--set 'shardsvr.dataNode.extraEnvVars[0].name=MONGODB_APP_USERNAME' \
135+
--set 'shardsvr.dataNode.extraEnvVars[0].valueFrom.secretKeyRef.name=mongodb-db-creds' \
136+
--set 'shardsvr.dataNode.extraEnvVars[0].valueFrom.secretKeyRef.key=mongodb-username' \
137+
--set 'shardsvr.dataNode.extraEnvVars[1].name=MONGODB_APP_DATABASE' \
138+
--set 'shardsvr.dataNode.extraEnvVars[1].valueFrom.secretKeyRef.name=mongodb-db-creds' \
139+
--set 'shardsvr.dataNode.extraEnvVars[1].valueFrom.secretKeyRef.key=mongodb-database' \
140+
--set 'shardsvr.dataNode.extraEnvVars[2].name=MONGODB_APP_PASSWORD' \
141+
--set 'shardsvr.dataNode.extraEnvVars[2].valueFrom.secretKeyRef.name=mongodb-db-creds' \
142+
--set 'shardsvr.dataNode.extraEnvVars[2].valueFrom.secretKeyRef.key=mongodb-password'
125143
}
126144

127145
function mongodb_sharded_yamls()

solution-base/mongodb/charts/mongodb-sharded/templates/_helpers.tpl

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -253,21 +253,3 @@ mongodb: .Values.mongos.servicePerReplica.loadBalancerIPs
253253
{{- include "common.warnings.rollingTag" .Values.metrics.image }}
254254
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
255255
{{- end -}}
256-
{{/* app credentials environment variables */}}
257-
{{- define "mongodb-sharded.appAccountEnvs" -}}
258-
- name: MONGODB_APP_USERNAME
259-
valueFrom:
260-
secretKeyRef:
261-
name: {{ include "mongodb-sharded.secret" $ }}
262-
key: mongodb-username
263-
- name: MONGODB_APP_DATABASE
264-
valueFrom:
265-
secretKeyRef:
266-
name: {{ include "mongodb-sharded.secret" $ }}
267-
key: mongodb-database
268-
- name: MONGODB_APP_PASSWORD
269-
valueFrom:
270-
secretKeyRef:
271-
name: {{ include "mongodb-sharded.secret" $ }}
272-
key: mongodb-password
273-
{{- end -}}

solution-base/mongodb/charts/mongodb-sharded/templates/config-server/config-server-statefulset.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ spec:
165165
name: {{ include "mongodb-sharded.secret" . }}
166166
key: mongodb-replica-set-key
167167
{{- end }}
168-
{{- include "mongodb-sharded.appAccountEnvs" $ | nindent 12 }}
169168
{{- end }}
170169
- name: MONGODB_ENABLE_IPV6
171170
{{- if .Values.common.mongodbEnableIPv6 }}

solution-base/mongodb/charts/mongodb-sharded/templates/shard/shard-data-statefulset.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ spec:
172172
name: {{ include "mongodb-sharded.secret" $ }}
173173
key: mongodb-replica-set-key
174174
{{- end }}
175-
{{- include "mongodb-sharded.appAccountEnvs" $ | nindent 12 }}
176175
{{- end }}
177176
- name: MONGODB_ENABLE_IPV6
178177
{{- if $.Values.common.mongodbEnableIPv6 }}

solution-base/mongodb/patches/credentials-helper.patch

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)