{{- if .Values.cluster.create }}

apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.cluster.secretRefName }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "storageos.name" . }}
    chart: {{ template "storageos.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
type: "kubernetes.io/storageos"
data:
  apiUsername: {{ default "" .Values.cluster.admin.username | b64enc | quote }}
  {{ if .Values.cluster.admin.password }}
  apiPassword: {{ default "" .Values.cluster.admin.password | b64enc | quote }}
  {{ else }}
  apiPassword: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end }}
  # Add base64 encoded TLS cert and key below if ingress.tls is set to true.
  # tls.crt:
  # tls.key:
  # Add base64 encoded creds below for CSI credentials.
  # csiProvisionUsername:
  # csiProvisionPassword:
  # csiControllerPublishUsername:
  # csiControllerPublishPassword:
  # csiNodePublishUsername:
  # csiNodePublishPassword:

{{- end }}
