{{- if and .Values.config.google (and (not .Values.config.google.existingSecret) (not .Values.config.google.useApplicationDefaultCredentials)) }}
apiVersion: v1
kind: Secret
metadata:
  labels:
    app: {{ template "oauth2-proxy.name" . }}
{{- include "oauth2-proxy.labels" . | indent 4 }}
  name: {{ template "oauth2-proxy.fullname" . }}-google
  namespace: {{ template "oauth2-proxy.namespace" $ }}
type: Opaque
data:
  service-account.json: {{ .Values.config.google.serviceAccountJson | b64enc | quote }}
{{- end -}}
