{{- if and .Values.auth.rbac.enabled (not .Values.auth.rbac.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "etcd.fullname" . }}
  labels: {{- include "etcd.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if .Values.auth.rbac.rootPassword }}
  etcd-root-password: {{ .Values.auth.rbac.rootPassword | b64enc | quote }}
  {{- else }}
  etcd-root-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{- end }}
{{- end }}
