{{- with .Values.gateway }}
{{- if and .enabled .basicAuth.enabled (not .basicAuth.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "loki.gatewayFullname" $ }}
  namespace: {{ $.Release.Namespace }}
  labels:
    {{- include "loki.gatewayLabels" $ | nindent 4 }}
stringData:
  .htpasswd: |
    {{- tpl .basicAuth.htpasswd $ | nindent 4 }}
{{- end }}
{{- end }}