# helm_charts_configmap-htpasswd-file.yaml
{{- if and .Values.htpasswdFile.enabled (not .Values.htpasswdFile.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
  labels:
    app: {{ template "oauth2-proxy.name" . }}
    chart: {{ template "oauth2-proxy.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  name: {{ template "oauth2-proxy.fullname" . }}-htpasswd-file
type: Opaque
stringData:
  users.txt: |-
    {{- range $entries := .Values.htpasswdFile.entries }}
    {{ $entries }}
    {{- end -}}
{{- end }}