Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / common / elasticsearch / components / curator / hooks / job.install.yaml
1 {{/*
2 # Copyright © 2020 Bitnami, AT&T, Amdocs, Bell Canada, highstreet technologies
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16 {{- if .Values.enabled }}
17 {{- range $kind, $enabled := .Values.hooks }}
18 {{- if $enabled }}
19 ---
20 apiVersion: batch/v1
21 kind: Job
22 metadata:
23   name: {{ include "common.fullname" . }}-curator-on-{{ $kind }}
24   namespace: {{ include "common.namespace" . }}
25   labels: {{- include "common.labels" . | nindent 2 }}
26     role: "curator"
27   annotations:
28     "helm.sh/hook": post-{{ $kind }}
29     "helm.sh/hook-weight": "1"
30 {{- if $.Values.cronjob.annotations }}
31 {{ toYaml $.Values.cronjob.annotations | indent 4 }}
32 {{- end }}
33 spec:
34  template:
35     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
36     spec:
37       volumes:
38         - name: config-volume
39           configMap:
40             name: {{ template "common.fullname" (dict "suffix" "curator" "dot" .) }}
41 {{- if $.Values.extraVolumes }}
42 {{ toYaml $.Values.extraVolumes | indent 8 }}
43 {{- end }}
44       restartPolicy: Never
45 {{- if $.Values.priorityClassName }}
46       priorityClassName: "{{ $.Values.priorityClassName }}"
47 {{- end }}
48       containers:
49         - name: {{ template "common.fullname" . }}-curator
50           image: {{printf "%s/%s" (include "repositoryGenerator.repository" .)  .Values.image }}
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           volumeMounts:
53             - name: config-volume
54               mountPath: /etc/es-curator
55     {{- if $.Values.extraVolumeMounts }}
56 {{ toYaml $.Values.extraVolumeMounts | indent 12 }}
57     {{- end }}
58           command: [ "curator" ]
59           args: [ "--config", "/etc/es-curator/config.yml", "/etc/es-curator/action_file.yml" ]
60           resources:
61 {{ toYaml $.Values.resources | indent 12 }}
62     {{- with $.Values.nodeSelector }}
63       nodeSelector:
64 {{ toYaml . | indent 8 }}
65     {{- end }}
66     {{- with $.Values.affinity }}
67       affinity:
68 {{ toYaml . | indent 8 }}
69     {{- end }}
70     {{- with $.Values.tolerations }}
71       tolerations:
72 {{ toYaml . | indent 8 }}
73     {{- end }}
74 {{- end -}}
75 {{- end }}
76 {{- end }}