{{- if .Values.curator.enabled }} apiVersion: {{ template "cronjob.apiVersion" . }} kind: CronJob metadata: name: {{ template "elasticsearch.curator.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} app.kubernetes.io/component: curator ## Istio Labels: https://istio.io/docs/ops/deployment/requirements/ app: curator {{- if .Values.curator.cronjob.annotations }} annotations: {{- toYaml .Values.curator.cronjob.annotations | nindent 4 }} {{- end }} spec: schedule: "{{ .Values.curator.cronjob.schedule }}" {{- with .Values.curator.cronjob.concurrencyPolicy }} concurrencyPolicy: {{ . }} {{- end }} {{- with .Values.curator.cronjob.failedJobsHistoryLimit }} failedJobsHistoryLimit: {{ . }} {{- end }} {{- with .Values.curator.cronjob.successfulJobsHistoryLimit }} successfulJobsHistoryLimit: {{ . }} {{- end }} jobTemplate: metadata: labels: {{- include "common.labels.standard" . | nindent 8 }} app.kubernetes.io/component: curator ## Istio Labels: https://istio.io/docs/ops/deployment/requirements/ app: curator {{- if .Values.curator.podLabels }} {{- include "common.tplvalues.render" (dict "value" .Values.curator.podLabels "context" $) | nindent 8 }} {{- end }} spec: template: metadata: labels: {{- include "common.labels.standard" . | nindent 12 }} app.kubernetes.io/component: curator ## Istio Labels: https://istio.io/docs/ops/deployment/requirements/ app: curator {{- if .Values.curator.podAnnotations }} annotations: {{- toYaml .Values.curator.podAnnotations | nindent 12 }} {{- end }} spec: volumes: - name: config-volume configMap: name: {{ template "elasticsearch.curator.fullname" . }} {{- if .Values.curator.extraVolumes }} {{- toYaml .Values.curator.extraVolumes | nindent 12 }} {{- end }} restartPolicy: {{ .Values.curator.cronjob.jobRestartPolicy }} {{- if .Values.curator.priorityClassName }} priorityClassName: {{ .Values.curator.priorityClassName | quote }} {{- end }} {{- include "elasticsearch.imagePullSecrets" . | indent 10 }} {{- $initContainers := coalesce .Values.curator.initContainers .Values.curator.extraInitContainers -}} {{- if $initContainers }} initContainers: {{- include "common.tplvalues.render" (dict "value" $initContainers "context" $) | nindent 8 }} {{- end }} {{- if .Values.curator.schedulerName }} schedulerName: {{ .Values.curator.schedulerName }} {{- end }} {{- if .Values.curator.rbac.enabled }} serviceAccountName: {{ include "elasticsearch.curator.serviceAccountName" . }} {{- end }} {{- if .Values.curator.affinity }} affinity: {{- include "common.tplvalues.render" (dict "value" .Values.curator.affinity "context" $) | nindent 12 }} {{- else }} affinity: podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.curator.podAffinityPreset "component" "curator" "context" $) | nindent 14 }} podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.curator.podAntiAffinityPreset "component" "curator" "context" $) | nindent 14 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.curator.nodeAffinityPreset.type "key" .Values.curator.nodeAffinityPreset.key "values" .Values.curator.nodeAffinityPreset.values) | nindent 14 }} {{- end }} {{- if .Values.curator.nodeSelector }} nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.curator.nodeSelector "context" $) | nindent 12 }} {{- end }} {{- if .Values.curator.tolerations }} tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.curator.tolerations "context" $) | nindent 12 }} {{- end }} {{- if .Values.curator.topologySpreadConstraints }} topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.curator.topologySpreadConstraints "context" $) | nindent 12 }} {{- end }} {{- if .Values.curator.securityContext }} securityContext: {{- toYaml .Values.curator.securityContext | nindent 12 }} {{- end }} containers: - name: {{ template "elasticsearch.curator.fullname" . }} image: {{ template "elasticsearch.curator.image" . }} imagePullPolicy: {{ .Values.curator.image.pullPolicy | quote }} volumeMounts: - name: config-volume mountPath: /etc/es-curator {{- if .Values.curator.extraVolumeMounts }} {{- toYaml .Values.curator.extraVolumeMounts | nindent 16 }} {{- end }} {{- if .Values.diagnosticMode.enabled }} command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 16 }} {{ else if .Values.curator.command }} command: {{ toYaml .Values.curator.command | nindent 16 }} {{- end }} {{- if .Values.diagnosticMode.enabled }} args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 16 }} {{- else if .Values.curator.dryrun }} args: [ "--dry-run", "--config", "/etc/es-curator/config.yml", "/etc/es-curator/action_file.yml" ] {{- else }} args: [ "--config", "/etc/es-curator/config.yml", "/etc/es-curator/action_file.yml" ] {{- end }} env: {{- if .Values.curator.env }} {{- range $key,$value := .Values.curator.env }} - name: {{ $key | upper | quote}} value: {{ $value | quote}} {{- end }} {{- end }} {{- if .Values.curator.envFromSecrets }} {{- range $key,$value := .Values.curator.envFromSecrets }} - name: {{ $key | upper | quote}} valueFrom: secretKeyRef: name: {{ $value.from.secret | quote}} key: {{ $value.from.key | quote}} {{- end }} {{- end }} {{- if .Values.curator.resources }} resources: {{- toYaml .Values.curator.resources | nindent 16 }} {{- end }} {{- if .Values.curator.sidecars }} {{- include "common.tplvalues.render" ( dict "value" .Values.curator.sidecars "context" $) | nindent 12 }} {{- end }} {{- end }}