{{- if .Values.curator.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "elasticsearch.curator.fullname" . }}
  namespace: {{ include "common.names.namespace" . | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: curator
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
data:
  action_file.yml: {{ required "A valid .Values.curator.configMaps.action_file_yml entry is required!" (toYaml .Values.curator.configMaps.action_file_yml | indent 2) }}
  {{- if .Values.curator.configMaps.config_yml }}
  config.yml: {{- include "common.tplvalues.render" ( dict "value" .Values.curator.configMaps.config_yml "context" $ ) | nindent 2 }}
  {{- else }}
  config.yml: |-
    client:
      hosts:
        - {{ template "elasticsearch.service.name" . }}.{{ include "common.names.namespace" . }}.svc.{{ .Values.clusterDomain }}
      port: {{ include "elasticsearch.service.ports.restAPI" . }}
  {{- end }}
{{- end }}
