Skip to content

Commit

Permalink
Merge pull request #263 from devtron-labs/backup_chart2.4
Browse files Browse the repository at this point in the history
fix: Backup chart2.4
  • Loading branch information
tayalrishabh96 authored Feb 11, 2025
2 parents cbb3d68 + dbc4887 commit dae23e3
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 80 deletions.
2 changes: 1 addition & 1 deletion charts/devtron-backups/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
appVersion: "2.0"
description: A Helm chart for Devtron Backups
name: devtron-backups
version: 0.2.4
version: 0.2.5
48 changes: 28 additions & 20 deletions charts/devtron-backups/templates/backup-on-azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,23 @@ kind: CronJob
metadata:
name: postgres-app-backup-cronjob
namespace: devtroncd
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: {{ .Values.global.schedule }}
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
initContainers:
- name: postgres-app-backup-cronjob
Expand All @@ -58,7 +61,7 @@ spec:
- -c
- set -ex ; pg_dumpall -h {{ .Values.postgres_backup.host | default "postgresql-postgresql.devtroncd" }} --exclude-database=clairv4 -p 5432 -U postgres --no-privileges > /postgres/backup.tar; echo $? ; du -sh /postgres/backup.tar
resources:
{{ toYaml .Values.postgres_backup.resources | indent 12 }}
{{ toYaml .Values.postgres_backup.resources | indent 14 }}
containers:
- name: az-cli-for-upload
image: {{ .Values.global.AZURE.image | default "quay.io/devtron/k8s-utils:az-cli-ubuntu" }}
Expand All @@ -81,14 +84,16 @@ spec:
secretKeyRef:
name: devtron-azure-backup-secret
key: AZURE_BLOB_CONTAINER_FOR_POSTGRES
{{- if .Values.argocd_backup.enabled }}
- name: AZURE_BLOB_CONTAINER_FOR_ARGOCD
valueFrom:
secretKeyRef:
name: devtron-azure-backup-secret
key: AZURE_BLOB_CONTAINER_FOR_ARGOCD
{{- end }}
imagePullPolicy: Always
resources:
{{ toYaml .Values.postgres_backup.resources | indent 12 }}
{{ toYaml .Values.postgres_backup.resources | indent 14 }}
args:
- /bin/bash
- -c
Expand Down Expand Up @@ -121,20 +126,23 @@ kind: CronJob
metadata:
name: argocd-app-backup-cronjob
namespace: devtroncd
{{- if $.Values.argocd_backup.labels }}
labels:
{{ toYaml .Values.argocd_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.argocd_backup.annotations }}
annotations:
{{ toYaml .Values.argocd_backup.annotations | indent 4 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: {{ .Values.global.schedule }}
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
initContainers:
- name: argocd-app-backup-job
Expand All @@ -149,7 +157,7 @@ spec:
- -c
- {{ .Values.argocd_backup.args | default "argocd admin export -n devtroncd > /argocd/backup.yaml" }}
resources:
{{ toYaml .Values.argocd_backup.resources | indent 12 }}
{{ toYaml .Values.argocd_backup.resources | indent 14 }}
containers:
- name: az-cli-for-upload
image: {{ .Values.global.AZURE.image | default "quay.io/devtron/k8s-utils:az-cli-ubuntu" }}
Expand Down Expand Up @@ -179,7 +187,7 @@ spec:
key: AZURE_BLOB_CONTAINER_FOR_ARGOCD
imagePullPolicy: Always
resources:
{{ toYaml .Values.argocd_backup.resources | indent 12 }}
{{ toYaml .Values.argocd_backup.resources | indent 14 }}
args:
- /bin/bash
- -c
Expand Down
46 changes: 26 additions & 20 deletions charts/devtron-backups/templates/backup-on-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,23 @@ kind: CronJob
metadata:
name: postgres-app-backup-cronjob
namespace: devtroncd
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: "{{ .Values.global.schedule }}"
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
initContainers:
- name: postgres-app-backup-cronjob
Expand All @@ -56,7 +59,7 @@ spec:
- -c
- set -ex; pg_dumpall -h {{ .Values.postgres_backup.host | default "postgresql-postgresql.devtroncd" }} --exclude-database=clairv4 -p 5432 -U postgres --no-privileges > /postgres/backup.tar; echo $? ; du -sh /postgres/backup.tar
resources:
{{ toYaml .Values.postgres_backup.resources | indent 12 }}
{{ toYaml .Values.postgres_backup.resources | indent 14 }}
containers:
- name: gcloud-cli-for-cloud-storage-upload
image: {{ .Values.global.GCP.image | default "google/cloud-sdk:alpine" }}
Expand All @@ -78,7 +81,7 @@ spec:
{{- end }}
imagePullPolicy: Always
resources:
{{ toYaml .Values.postgres_backup.resources | indent 12 }}
{{ toYaml .Values.postgres_backup.resources | indent 14 }}
args:
- /bin/bash
- -c
Expand Down Expand Up @@ -112,20 +115,23 @@ kind: CronJob
metadata:
name: argocd-app-backup-cronjob
namespace: devtroncd
{{- if $.Values.argocd_backup.labels }}
labels:
{{ toYaml .Values.argocd_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.argocd_backup.annotations }}
annotations:
{{ toYaml .Values.argocd_backup.annotations | indent 4 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: "{{ .Values.global.schedule }}"
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
initContainers:
- name: argocd-app-backup-job
Expand All @@ -140,7 +146,7 @@ spec:
- -c
- {{ .Values.argocd_backup.args | default "argocd admin export -n devtroncd > /argocd/backup.yaml" }}
resources:
{{ toYaml .Values.argocd_backup.resources | indent 12 }}
{{ toYaml .Values.argocd_backup.resources | indent 14 }}
containers:
- name: gcloud-cli-for-cloud-storage-upload
image: {{ .Values.global.GCP.image | default "google/cloud-sdk:alpine" }}
Expand All @@ -162,7 +168,7 @@ spec:
{{- end }}
imagePullPolicy: Always
resources:
{{ toYaml .Values.argocd_backup.resources | indent 12 }}
{{ toYaml .Values.argocd_backup.resources | indent 14 }}
args:
- /bin/bash
- -c
Expand Down
38 changes: 22 additions & 16 deletions charts/devtron-backups/templates/backup-on-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ kind: CronJob
metadata:
name: postgres-app-backup-cronjob
namespace: devtroncd
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 6 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 6 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: {{ .Values.global.schedule }}
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
containers:
- name: postgres-app-backup-cronjob
Expand Down Expand Up @@ -93,20 +96,23 @@ kind: CronJob
metadata:
name: argocd-app-backup-job
namespace: devtroncd
{{- if $.Values.argocd_backup.labels }}
labels:
{{ toYaml .Values.argocd_backup.labels | indent 6 }}
{{- end }}
{{- if $.Values.argocd_backup.annotations }}
annotations:
{{ toYaml .Values.argocd_backup.annotations | indent 6 }}
{{- end }}
spec:
timeZone: {{ .Values.global.timezone | default "UTC" }}
schedule: {{ .Values.global.schedule }}
jobTemplate:
spec:
template:
{{- if or $.Values.postgres_backup.labels $.Values.postgres_backup.annotations }}
metadata:
{{- if $.Values.postgres_backup.labels }}
labels:
{{ toYaml .Values.postgres_backup.labels | indent 4 }}
{{- end }}
{{- if $.Values.postgres_backup.annotations }}
annotations:
{{ toYaml .Values.postgres_backup.annotations | indent 4 }}
{{- end }}
{{- end }}
spec:
containers:
- name: argocd-app-backup-job
Expand Down
Loading

0 comments on commit dae23e3

Please sign in to comment.