Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
feat: add support for additional volumes and volume mounts for the ba…
Browse files Browse the repository at this point in the history
…ckup job (#86)
  • Loading branch information
ekeih authored May 14, 2022
1 parent df423da commit 99263ea
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion charts/backup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ apiVersion: v2
name: backup
description: Chart to back up PVCs with restic and regularly clean up the snapshots.
type: application
version: 2.7.0
version: 2.8.0
maintainers:
- name: morremeyer
email: [email protected]
- name: ekeih
5 changes: 4 additions & 1 deletion charts/backup/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# backup

![Version: 2.7.0](https://img.shields.io/badge/Version-2.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 2.8.0](https://img.shields.io/badge/Version-2.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

Chart to back up PVCs with restic and regularly clean up the snapshots.

Expand All @@ -9,6 +9,7 @@ Chart to back up PVCs with restic and regularly clean up the snapshots.
| Name | Email | Url |
| ---- | ------ | --- |
| morremeyer | <[email protected]> | |
| ekeih | | |

## Usage

Expand Down Expand Up @@ -40,8 +41,10 @@ The following table lists the configurable parameters of the chart and the defau
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| backupJob.additionalVolumes | list | `[]` | Additional volumes to add to the pod, e.g. to backup hostPaths. |
| backupJob.affinity | object | `{}` | to specify a full `spec.affinity` map for a pod. In most cases, `backupJob.affinityLabels` will be sufficient. |
| backupJob.affinityLabels | object | `{}` | labels of a pod that a strict affinity for scheduling will be set to. Needed for `ReadWriteOnce` PVCs. |
| backupJob.backup.additionalVolumeMounts | list | `[]` | Additional volumes to mount to the restic container, e.g. to backup hostPaths. |
| backupJob.backup.args | list | `[]` | arguments for the backup. **Automatically generated, only set when necessary** |
| backupJob.backup.command | string | `nil` | command for the backup. Defaults to '/usr/bin/restic' by the upstream container. |
| backupJob.backup.image.pullPolicy | string | `"IfNotPresent"` | |
Expand Down
14 changes: 12 additions & 2 deletions charts/backup/templates/cronjob-backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,16 @@ spec:
resources:
{{- toYaml . | nindent 14 }}
{{- end }}
{{- if .Values.pvc }}
{{- if or .Values.pvc .Values.backupJob.backup.additionalVolumeMounts }}
volumeMounts:
{{- end }}
{{- if .Values.pvc }}
- mountPath: "/data"
name: data
{{- end }}
{{- if .Values.backupJob.backup.additionalVolumeMounts }}
{{- toYaml .Values.backupJob.backup.additionalVolumeMounts | nindent 14 }}
{{- end }}
restartPolicy: {{ .Values.backupJob.restartPolicy }}
{{- with .Values.backupJob.nodeSelector }}
nodeSelector:
Expand All @@ -98,10 +103,15 @@ spec:
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.pvc }}
{{- if or .Values.pvc .Values.backupJob.additionalVolumes }}
volumes:
{{- end }}
{{- if .Values.pvc }}
- name: data
persistentVolumeClaim:
claimName: {{ .Values.pvc }}
{{- end }}
{{- if .Values.backupJob.additionalVolumes }}
{{- toYaml .Values.backupJob.additionalVolumes | nindent 12 }}
{{- end }}

6 changes: 6 additions & 0 deletions charts/backup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ backupJob:
# -- failedJobsHistoryLimit for the backup Jobs
failedJobsHistoryLimit: 1

# -- Additional volumes to add to the pod, e.g. to backup hostPaths.
additionalVolumes: []

backup:
image:
repository: restic/restic
Expand All @@ -56,6 +59,9 @@ backupJob:
# -- resources for the backup container
resources: {}

# -- Additional volumes to mount to the restic container, e.g. to backup hostPaths.
additionalVolumeMounts: []

# -- Configuration for the repository init container
init:
image:
Expand Down

0 comments on commit 99263ea

Please sign in to comment.