charts/templates/secret.yaml
{{- if .Values.secrets.enabled }}
{{- $fullName := include "backend-java-patterns.fullname" . -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "backend-java-patterns.labels" . | nindent 4 }}
{{- if .Values.secrets.labels }}
{{- with .Values.secrets.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .Values.secrets.annotations }}
{{- with .Values.secrets.annotations }}
annotations:
{{- toYaml . | indent 4 }}
{{- end }}
{{- end }}
data:
base-url: {{ default "" .Values.secrets.data.baseUrl | b64enc | quote }}
{{- if .Values.secrets.data.basePassword }}
base-password: "{{ .Values.secrets.data.basePassword | b64enc }}"
{{- else if (not .Values.secrets.data.forcePassword) }}
base-password: "{{ randAlphaNum 10 | b64enc }}"
{{ else }}
base-password: {{ required "A Base Password is required!" .Values.secrets.data.basePassword }}
{{- end }}
{{- if .Values.secrets.data.baseToken }}
base-token: {{ .Values.secrets.data.baseToken | b64enc | quote }}
{{- else }}
base-token: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- range $key, $value := .Values.secrets.extra }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}