diff --git a/charts/dbp-moodle/README.md b/charts/dbp-moodle/README.md index d0b57e1..31448bc 100644 --- a/charts/dbp-moodle/README.md +++ b/charts/dbp-moodle/README.md @@ -83,8 +83,10 @@ The Chart can be deployed without any modification but it is advised to set own | backup-cronjob.serviceAccount.create | bool | `false` | | | backup-cronjob.serviceAccount.name | string | `"moodle-backup-job"` | | | backup-cronjob.tolerations | list | `[]` | | -| dbpMoodle.backup | object | `{"cluster_name":"","enabled":false,"endpoint":"","gpg_key_names":"","gpgkeys":{"existingSecret":"","gpgkey.dbpinfra.pub.asc":"","gpgkey.dbpinfra.sec.asc":""},"rules":[{"apiGroups":["apps"],"resources":["deployments"],"verbs":["get","patch","list","watch"]},{"apiGroups":["batch"],"resources":["cronjobs","jobs"],"verbs":["get","patch"]}],"s3_bucket_name":"","secrets":{"existingSecret":"","s3_access_key":"","s3_access_secret":"","s3_endpoint_url":""}}` | Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials | +| dbpMoodle.backup | object | `{"cluster_name":"","enabled":false,"endpoint":"","gpg_key_names":"","gpgkeys":{"existingSecret":"","gpgkey.dbpinfra.pub.asc":"","gpgkey.dbpinfra.sec.asc":""},"max_full_backup_age":"1W","retention_time":"6M","rules":[{"apiGroups":["apps"],"resources":["deployments"],"verbs":["get","patch","list","watch"]},{"apiGroups":["batch"],"resources":["cronjobs","jobs"],"verbs":["get","patch"]}],"s3_bucket_name":"","secrets":{"existingSecret":"","s3_access_key":"","s3_access_secret":"","s3_endpoint_url":""}}` | Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials | | dbpMoodle.backup.gpgkeys.existingSecret | string | `""` | Existing secret for gpg keys | +| dbpMoodle.backup.max_full_backup_age | string | `"1W"` | Defines the maximum age of a full backup before a new full backup is created. The backups in between are incremental | +| dbpMoodle.backup.retention_time | string | `"6M"` | Defines the maximum age of a backup before it is deleted | | dbpMoodle.backup.secrets | object | `{"existingSecret":"","s3_access_key":"","s3_access_secret":"","s3_endpoint_url":""}` | Either provide an existing secret, or set each secret value here. If both are set the existingSecret is used | | dbpMoodle.backup.secrets.existingSecret | string | `""` | Existing secret for s3 endpoint | | dbpMoodle.debug | bool | `false` | Moodle debugging is not safe for production | diff --git a/charts/dbp-moodle/templates/_helpers.tpl b/charts/dbp-moodle/templates/_helpers.tpl index 323225a..a42a877 100644 --- a/charts/dbp-moodle/templates/_helpers.tpl +++ b/charts/dbp-moodle/templates/_helpers.tpl @@ -47,6 +47,14 @@ {{- default "moodle" .Values.dbpMoodle.secrets.etherpad_api_key }} {{- end -}} +{{- define "dbpMoodle.backup.retention_time" -}} +{{- default "6M" .Values.dbpMoodle.backup.retention_time }} +{{- end -}} + +{{- define "dbpMoodle.backup.max_full_backup_age" -}} +{{- default "1W" .Values.dbpMoodle.backup.max_full_backup_age }} +{{- end -}} + {{- define "dbpMoodle.pluginConfigMap.content" -}} kaltura:kaltura:: {{- .Values.global.moodlePlugins.kaltura.enabled }}{{"\n"}} wunderbyte_table:local_wunderbyte_table:local/wunderbyte_table: {{- .Values.global.moodlePlugins.booking.enabled}}{{"\n"}} diff --git a/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml b/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml index 79b41c3..212bbc0 100644 --- a/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml +++ b/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml @@ -12,8 +12,8 @@ data: GPG="/usr/bin/gpg" TARGET="boto3+s3://{{ .Values.dbpMoodle.backup.s3_bucket_name }}/{{ .Values.dbpMoodle.backup.cluster_name }}/{{ .Release.Namespace }}/" SOURCE='/' - MAX_AGE=6M - MAX_FULLBKP_AGE=1W + MAX_AGE={{ include "dbpMoodle.backup.retention_time" . }} + MAX_FULLBKP_AGE={{ include "dbpMoodle.backup.max_full_backup_age" . }} DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE --allow-source-mismatch --s3-endpoint-url {{ .Values.dbpMoodle.backup.endpoint }}" exclude: |- + /tmp/backup diff --git a/charts/dbp-moodle/values.yaml b/charts/dbp-moodle/values.yaml index 6a4d59d..7a9d5f2 100644 --- a/charts/dbp-moodle/values.yaml +++ b/charts/dbp-moodle/values.yaml @@ -122,6 +122,10 @@ dbpMoodle: # -- Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials backup: enabled: false + # -- Defines the maximum age of a backup before it is deleted + retention_time: "6M" + # -- Defines the maximum age of a full backup before a new full backup is created. The backups in between are incremental + max_full_backup_age: "1W" gpg_key_names: "" gpgkeys: gpgkey.dbpinfra.pub.asc: ""