# helm_charts_keycloak-secret.yaml
{{- if not .Values.keycloak.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "keycloak.fullname" . }}-http
  labels:
    app: {{ template "keycloak.name" . }}
    chart: {{ template "keycloak.chart" . }}
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{- if .Values.keycloak.password }}
        {{ .Values.keycloak.existingSecretKey }}: {{ .Values.keycloak.password | b64enc | quote }}
{{- else }}
        {{ .Values.keycloak.existingSecretKey }}: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end}}