Files
sa-charts/helm/mysql/templates/secrets.yaml
marsal wang 1e5a703cce swarm
2023-07-26 10:07:34 +08:00

40 lines
1.8 KiB
YAML

{{- if eq (include "mysql.createSecret" .) "true" }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- if not (empty .Values.auth.rootPassword) }}
mysql-root-password: {{ .Values.auth.rootPassword | b64enc | quote }}
{{- else if (not .Values.auth.forcePassword) }}
mysql-root-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- else }}
mysql-root-password: {{ required "A MySQL Root Password is required!" .Values.auth.rootPassword }}
{{- end }}
{{- if and (not (empty .Values.auth.username)) (not (empty .Values.auth.password)) }}
mysql-password: {{ .Values.auth.password | b64enc | quote }}
{{- else if (not .Values.auth.forcePassword) }}
mysql-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- else }}
mysql-password: {{ required "A MySQL Database Password is required!" .Values.auth.password }}
{{- end }}
{{- if eq .Values.architecture "replication" }}
{{- if not (empty .Values.auth.replicationPassword) }}
mysql-replication-password: {{ .Values.auth.replicationPassword | b64enc | quote }}
{{- else if (not .Values.auth.forcePassword) }}
mysql-replication-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- else }}
mysql-replication-password: {{ required "A MySQL Replication Password is required!" .Values.auth.replicationPassword }}
{{- end }}
{{- end }}
{{- end }}