Skip to content

Commit b49d118

Browse files
Modify S3 backup configuration and add PVC
Updated backup-on-s3.yaml to conditionally set AWS_ACCESS_KEY and AWS_SECRET_KEY based on NODE_ROLE. Changed restartPolicy from Never to OnFailure and added PersistentVolumeClaim for S3 backups.
1 parent 0d0ca23 commit b49d118

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

charts/devtron-backups/templates/backup-on-s3.yaml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
type: Opaque
99
data:
1010
S3_BUCKET_NAME: {{ .Values.global.S3.S3_BUCKET_NAME | b64enc }}
11-
{{- if .Values.global.S3.S3_ACCESS_KEY }}
11+
{{- if eq .Values.global.S3.NODE_ROLE "false" }}
1212
AWS_ACCESS_KEY: {{ .Values.global.S3.S3_ACCESS_KEY | b64enc }}
1313
AWS_SECRET_KEY: {{ .Values.global.S3.S3_SECRET_KEY | b64enc }}
1414
{{- end }}
@@ -33,10 +33,6 @@ spec:
3333
schedule: "{{ .Values.global.schedule }}"
3434
jobTemplate:
3535
spec:
36-
backoffLimit: 0
37-
{{- if $.Values.global.extraConfig }}
38-
{{ toYaml $.Values.global.extraConfig | indent 6 }}
39-
{{- end }}
4036
template:
4137
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
4238
metadata:
@@ -115,7 +111,12 @@ spec:
115111
{{ include "devtron.postgresBackup" . | indent 6 }}
116112
volumes:
117113
- name: psql-volume
118-
emptyDir: {}
114+
persistentVolumeClaim:
115+
{{- if and .Values.global.S3.PERSISTENCE.enabled .Values.global.S3.PERSISTENCE.existingClaim }}
116+
claimName: {{ .Values.global.S3.PERSISTENCE.existingClaim }}
117+
{{- else }}
118+
claimName: devtron-backup-pvc
119+
{{- end }}
119120
{{- if $.Values.global.nodeSelector }}
120121
nodeselector:
121122
{{ toYaml .Values.global.nodeSelector | indent 12 }}
@@ -124,7 +125,7 @@ spec:
124125
tolerations:
125126
{{ toYaml .Values.global.tolerations | indent 12 }}
126127
{{- end }}
127-
restartPolicy: Never
128+
restartPolicy: OnFailure
128129
{{- end }}
129130
---
130131
{{- if .Values.argocd_backup.enabled }}
@@ -142,10 +143,6 @@ spec:
142143
schedule: "{{ .Values.global.schedule }}"
143144
jobTemplate:
144145
spec:
145-
backoffLimit: 0
146-
{{- if $.Values.global.extraConfig }}
147-
{{ toYaml $.Values.global.extraConfig | indent 6 }}
148-
{{- end }}
149146
template:
150147
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
151148
metadata:
@@ -227,7 +224,25 @@ spec:
227224
tolerations:
228225
{{ toYaml .Values.global.tolerations | indent 12 }}
229226
{{- end }}
230-
restartPolicy: Never
227+
restartPolicy: OnFailure
231228
serviceAccountName: {{ .Values.argocd_backup.serviceAccountName }}
232229
{{- end }}
233-
{{- end }}
230+
{{- end }}
231+
232+
{{- if and (.Values.global.S3.enabled) (.Values.global.S3.PERSISTENCE.enabled) (not .Values.global.S3.PERSISTENCE.existingClaim) }}
233+
---
234+
apiVersion: v1
235+
kind: PersistentVolumeClaim
236+
metadata:
237+
name: devtron-backup-pvc
238+
namespace: devtroncd
239+
spec:
240+
{{- if .Values.global.S3.PERSISTENCE.storageClass }}
241+
storageClassName: {{ .Values.global.S3.PERSISTENCE.storageClass }}
242+
{{- end }}
243+
accessModes:
244+
- ReadWriteOnce
245+
resources:
246+
requests:
247+
storage: {{ .Values.global.S3.PERSISTENCE.size }}
248+
{{- end }}

0 commit comments

Comments
 (0)