apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "spark-history-server.fullname" . }}
  labels:
    app.kubernetes.io/name: {{ include "spark-history-server.name" . }}
    helm.sh/chart: {{ include "spark-history-server.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
  enablePVC: {{ .Values.pvc.enablePVC | quote }}
  enableGCS: {{ .Values.gcs.enableGCS | quote }}
  enableS3: {{ .Values.s3.enableS3 | quote }}
  enableWASBS: {{ .Values.wasbs.enableWASBS | quote }}
  {{- range $key, $val := .Values.environment }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- if .Values.pvc.enablePVC }}
  {{- range $key, $val := omit .Values.pvc "enablePVC" }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- else if .Values.gcs.enableGCS }}
  {{- range $key, $val := omit .Values.gcs "enableGCS" }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- else if .Values.s3.enableS3 }}
  {{- range $key, $val := omit .Values.s3 "enableS3" }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- else if .Values.wasbs.enableWASBS }}
  {{- range $key, $val := omit .Values.wasbs "enableWASBS" }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- else }}
  {{- range $key, $val := .Values.hdfs }}
  {{ $key }}: {{ $val | quote }}
  {{- end }}
  {{- end }}
