{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "minio.fullname" . }}
  labels:
    app: {{ template "minio.name" . }}
    chart: {{ template "minio.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  accesskey: {{ if .Values.accessKey }}{{ .Values.accessKey | b64enc | quote }}{{ else }}{{ randAlphaNum 20 | b64enc | quote }}{{ end }}
  secretkey: {{ if .Values.secretKey }}{{ .Values.secretKey | b64enc | quote }}{{ else }}{{ randAlphaNum 40 | b64enc | quote }}{{ end }}
{{- if .Values.gcsgateway.enabled }}
  gcs_key.json: {{ .Values.gcsgateway.gcsKeyJson | b64enc }}
{{- end }}
{{- if .Values.s3gateway.enabled -}}
{{- if .Values.s3gateway.accessKey }}
  awsAccessKeyId: {{ .Values.s3gateway.accessKey | b64enc | quote }}
{{- end }}
{{- if .Values.s3gateway.secretKey }}
  awsSecretAccessKey: {{ .Values.s3gateway.secretKey | b64enc | quote }}
{{- end }}
{{- end }}
{{- if .Values.etcd.clientCert }}
  etcd_client_cert.pem: {{ .Values.etcd.clientCert | b64enc | quote }}
{{- end }}
{{- if .Values.etcd.clientCertKey }}
  etcd_client_cert_key.pem: {{ .Values.etcd.clientCertKey | b64enc | quote }}
{{- end }}
{{- end }}
