Files
dsk-iac/ansible/roles/helm_install/files/mongo-manifest/templates/secrets.yaml
2022-12-09 13:38:44 +09:00

31 lines
1.2 KiB
YAML

{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
type: Opaque
data:
{{- if .Values.configsvr.external.rootPassword }}
mongodb-root-password: {{ .Values.configsvr.external.rootPassword | b64enc | quote }}
{{- else if .Values.mongodbRootPassword }}
mongodb-root-password: {{ .Values.mongodbRootPassword | b64enc | quote }}
{{- else }}
mongodb-root-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if and .Values.mongodbUsername .Values.mongodbDatabase }}
{{- if .Values.mongodbPassword }}
mongodb-password: {{ .Values.mongodbPassword | b64enc | quote }}
{{- else }}
mongodb-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end }}
{{- if .Values.configsvr.external.replicasetKey }}
mongodb-replica-set-key: {{ .Values.configsvr.external.replicasetKey | b64enc | quote }}
{{- else if .Values.replicaSetKey }}
mongodb-replica-set-key: {{ .Values.replicaSetKey | b64enc | quote }}
{{- else }}
mongodb-replica-set-key: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end }}