{{- if .Values.secret.create }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.secret.name | default (include "keel.fullname" .) }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "keel.name" . }}
    chart: {{ template "keel.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
{{- if (and .Values.ecr.enabled .Values.ecr.secretAccessKey) }}
  AWS_SECRET_ACCESS_KEY:  {{ .Values.ecr.secretAccessKey | b64enc }}
{{- end }}
{{- if .Values.slack.enabled }}
  SLACK_TOKEN: {{ .Values.slack.token | b64enc }}
{{- end }}
{{- if .Values.googleApplicationCredentials }}
  google-application-credentials.json: {{ .Values.googleApplicationCredentials }}
{{- end }}
{{- if .Values.hipchat.enabled }}
  HIPCHAT_TOKEN: {{ .Values.hipchat.token | b64enc}}
  HIPCHAT_APPROVALS_PASSWORT: {{ .Values.hipchat.password | b64enc }}
{{- end }}
{{- if .Values.basicauth.enabled }}
  BASIC_AUTH_PASSWORD: {{ .Values.basicauth.password | b64enc }}
{{- end }}
{{- end }}
