Sync up to the latest it/dep commit.
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / charts / cassandra / templates / backup / cronjob.yaml
1 {{- if .Values.backup.enabled }}
2 {{- $release := .Release }}
3 {{- $values := .Values }}
4 {{- $backup := $values.backup }}
5 {{- range $index, $schedule := $backup.schedule }}
6 ---
7 apiVersion: batch/v1beta1
8 kind: CronJob
9 metadata:
10   name: {{ template "cassandra.fullname" $ }}-backup-{{ $schedule.keyspace | replace "_" "-" }}
11   labels:
12     app: {{ template "cassandra.name" $ }}-cain
13     chart: {{ template "cassandra.chart" $ }}
14     release: "{{ $release.Name }}"
15     heritage: "{{ $release.Service }}"
16 spec:
17   schedule: {{ $schedule.cron | quote }}
18   concurrencyPolicy: Forbid
19   startingDeadlineSeconds: 120
20   jobTemplate:
21     spec:
22       template:
23         metadata:
24           annotations:
25             {{ toYaml $backup.annotations }}
26         spec:
27           restartPolicy: OnFailure
28           serviceAccountName: {{ template "cassandra.serviceAccountName" $ }}
29           containers:
30           - name: cassandra-backup
31             image: "{{ $backup.image.repos }}:{{ $backup.image.tag }}"
32             command: ["cain"]
33             args:
34             - backup
35             - --namespace
36             - {{ $release.Namespace }}
37             - --selector
38             - release={{ $release.Name }},app={{ template "cassandra.name" $ }}
39             - --keyspace
40             - {{ $schedule.keyspace }}
41             - --dst
42             - {{ $backup.destination }}
43             {{- with $backup.extraArgs }}
44 {{ toYaml . | indent 12 }}
45           {{- end }}
46           {{- with $backup.env }}
47             env:
48 {{ toYaml . | indent 12 }}
49           {{- end }}
50           {{- with $backup.resources }}
51             resources:
52 {{ toYaml . | indent 14 }}
53           {{- end }}
54         affinity:
55           podAffinity:
56             preferredDuringSchedulingIgnoredDuringExecution:
57             - labelSelector:
58                 matchExpressions:
59                 - key: app
60                   operator: In
61                   values:
62                   - {{ template "cassandra.fullname" $ }}
63                 - key: release
64                   operator: In
65                   values:
66                   - {{ $release.Name }}
67               topologyKey: "kubernetes.io/hostname"
68       {{- with $values.tolerations }}
69         tolerations:
70 {{ toYaml . | indent 10 }}
71       {{- end }}
72 {{- end }}
73 {{- end }}