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