Skip to content

Commit

Permalink
feat(backup): add backup support (#26)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: antoninguyot <[email protected]>
  • Loading branch information
ArcRiiad and antoninguyot authored Dec 5, 2024
1 parent f29be92 commit 115b1ba
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
51 changes: 51 additions & 0 deletions templates/backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.backup.enabled | default false -}}
---
apiVersion: {{ include "common.capabilities.cronjob.apiVersion" . }}
kind: CronJob
metadata:
name: {{ template "common.names.fullname" . }}
labels: {{- include "horizon.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.backup.labels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.backup.labels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.commonAnnotations .Values.backup.annotations }}
annotations:
{{- if .Values.backup.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.backup.annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:
schedule: {{ .Values.backup.schedule | quote }}
suspend: {{ .Values.backup.suspended }}
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: {{ .Values.backup.successfulJobsHistoryLimit }}
failedJobsHistoryLimit: {{ .Values.backup.failedJobsHistoryLimit }}
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: {{ include "common.images.image" (dict "imageRoot" .Values.backup.image "global" .Values.global) }}
imagePullPolicy: {{ .Values.backup.imagePullPolicy | default "IfNotPresent" | quote }}
command:
- backup
env:
- name: MONGODB_URI
{{- include "horizon.mongodbUri" (dict "context" .) | nindent 16 }}
{{- with .Values.backup.environment }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backup.envFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
resources: {{- toYaml .Values.backup.resources | nindent 14 }}
backoffLimit: {{ .Values.backup.backoffLimit }}
{{- end -}}
47 changes: 47 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,53 @@ upgrade:
##
to: ""

## @section Backup parameters
backup:
## @param backup.enabled Whether to enable backup
enabled: false
## @param backup.annotations Extra annotations to add to the backup job
annotations: {}
## @param backup.labels Extra labels to add to the backup job
labels: {}
## @param backup.suspended Whether to suspend backup scheduling
suspended: false
## @param backup.schedule Cron expression for the backup job
schedule: "0 * * * *"
## @param backup.schedule Cron expression for the backup job
successfulJobsHistoryLimit: 1
##@ param backup.failedJobsHistoryLimit Cron expression for the backup job
failedJobsHistoryLimit: 3
## @param backup.backoffLimit Cron expression for the backup job
backoffLimit: 3
## @param backup.image.repository toolbox image repository
## @param backup.image.tag toolbox image tag (immutable tags are recommended)
## @param backup.image.pullPolicy toolbox image pull policy
## @param backup.image.pullSecrets toolbox image pull secrets
image:
registry: quay.io/evertrust
repository: toolbox
tag: v0.1.0
pullPolicy: IfNotPresent
pullSecrets: []
## backup container resource requests and limits
## ref: https://kubernetes.io/docs/user-guide/compute-resources/
## @param backup.resources.limits [object] The resources limits for the backup container
## @param backup.resources.requests [object] The requested resources for the backup container
resources:
limits:
memory: 126Mi
cpu: 500m
requests: {}
## Configure environment variable injections into the backup pods.
## This is the way you should inject secrets into the app if you wish
## to use the Kubernetes secrets implementation.
##
## ref: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/
## @param environment [array] Extra env vars passed to the backup pods
environment: []
## @param envFrom [array] Extra env vars passed to the backup pods
envFrom: []

## Configuration for an Horizon external database
## Refer to the Horizon installation guide to configure the installation correctly
##
Expand Down

0 comments on commit 115b1ba

Please sign in to comment.