{{- if and (not .Values.config.existingSecret) (.Values.proxyVarsAsSecrets) }}
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" . }}
type: Opaque
data:
  cookie-secret: {{ .Values.config.cookieSecret | b64enc | quote }}
  client-secret: {{ .Values.config.clientSecret | b64enc | quote }}
  client-id: {{ .Values.config.clientID | b64enc | quote }}
{{- end -}}
