{{- $operatorValues :=  index .Values "reporting-operator" -}}
{{- if and $operatorValues.spec.authProxy.enabled $operatorValues.spec.authProxy.cookie.createSecret -}}
{{- $_ := required "You must specify a non-empty reporting-operator.authProxy.cookie.seed value! It should be a random string at least 32 characters in length." $operatorValues.spec.authProxy.cookie.seed -}}
{{- if lt (len $operatorValues.spec.authProxy.cookie.seed) 32 -}}
{{- fail "reporting-operator.authProxy.cookie.seed should be a random string at least 32 characters in length." -}}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ $operatorValues.spec.authProxy.cookie.secretName }}
  labels:
    app: reporting-operator
type: Opaque
data:
  cookie-secret-seed: {{ $operatorValues.spec.authProxy.cookie.seed | b64enc | quote }}
{{- end -}}
