1 ################################################################################
2 # Copyright (c) 2021 HCL Technolgies Limited. #
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 #
8 # http://www.apache.org/licenses/LICENSE-2.0 #
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.backupRetention.enabled }}
17 apiVersion: batch/v1beta1
20 name: {{ include "common.fullname.influxdb" . }}-backup-retention
22 {{- include "common.influxdb.labels" . | nindent 4 }}
23 app.kubernetes.io/component: backup-retention
25 {{- toYaml .Values.backupRetention.annotations | nindent 4 }}
27 schedule: {{ .Values.backupRetention.schedule | quote }}
28 startingDeadlineSeconds: {{ .Values.backupRetention.startingDeadlineSeconds }}
29 concurrencyPolicy: Forbid
34 {{- if .Values.backupRetention.podAnnotations }}
36 {{ toYaml .Values.backupRetention.podAnnotations | nindent 12 }}
39 {{- include "common.influxdb.selectorLabels" . | nindent 12 }}
41 restartPolicy: OnFailure
45 name: {{ include "common.fullname.influxdb" . }}-backup-retention
46 {{- if .Values.backupRetention.gcs }}
47 {{- if .Values.backupRetention.gcs.serviceAccountSecret }}
48 - name: google-cloud-key
50 secretName: {{ .Values.backupRetention.gcs.serviceAccountSecret | quote }}
53 {{- if .Values.backupRetention.s3 }}
54 {{- if .Values.backupRetention.s3.credentialsSecret }}
55 - name: aws-credentials-secret
57 secretName: {{ .Values.backupRetention.s3.credentialsSecret | quote }}
60 serviceAccountName: {{ include "common.influxdb.serviceAccountName" . }}
62 {{- if .Values.backupRetention.gcs }}
64 {{- if .Values.backupRetention.azure }}
66 {{- if .Values.backupRetention.s3 }}
69 command: ['/bin/bash']
70 args: ['/scripts/backup-retention.sh']
74 {{- if .Values.backupRetention.s3.credentialsSecret}}
75 - name: aws-credentials-secret
76 mountPath: /var/secrets/aws/
79 - name: AWS_CONFIG_FILE
80 value: /var/secrets/aws/credentials
81 - name: DAYS_TO_RETAIN
82 value: {{ .Values.backupRetention.daysToRetain | quote }}
84 value: {{ .Values.backupRetention.s3.bucketName }}
86 value: {{ .Values.backupRetention.s3.endpointUrl }}
88 {{- toYaml .Values.backupRetention.resources | nindent 14 }}