From 44162fba87fee54309fb0b720791b7aab535241f Mon Sep 17 00:00:00 2001 From: marhode Date: Thu, 24 Oct 2024 13:22:02 +0200 Subject: [PATCH 1/6] Added retention time value for helm chart --- charts/dbp-moodle/templates/_helpers.tpl | 4 ++++ charts/dbp-moodle/templates/configmaps/duply-configmap.yaml | 2 +- charts/dbp-moodle/values.yaml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/dbp-moodle/templates/_helpers.tpl b/charts/dbp-moodle/templates/_helpers.tpl index 323225a..ca7dadf 100644 --- a/charts/dbp-moodle/templates/_helpers.tpl +++ b/charts/dbp-moodle/templates/_helpers.tpl @@ -47,6 +47,10 @@ {{- default "moodle" .Values.dbpMoodle.secrets.etherpad_api_key }} {{- end -}} +{{- define "dbpMoodle.backup.retention_time" -}} +{{- default "6M" .Values.dbpMoodle.backup.retention_time }} +{{- 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..840a092 100644 --- a/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml +++ b/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml @@ -12,7 +12,7 @@ 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_AGE={{ include "dbpMoodle.backup.retention_time" . }} MAX_FULLBKP_AGE=1W DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE --allow-source-mismatch --s3-endpoint-url {{ .Values.dbpMoodle.backup.endpoint }}" exclude: |- diff --git a/charts/dbp-moodle/values.yaml b/charts/dbp-moodle/values.yaml index 6a4d59d..ee7cfd5 100644 --- a/charts/dbp-moodle/values.yaml +++ b/charts/dbp-moodle/values.yaml @@ -122,6 +122,7 @@ dbpMoodle: # -- Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials backup: enabled: false + retention_time: "" gpg_key_names: "" gpgkeys: gpgkey.dbpinfra.pub.asc: "" From 0f9e1ca4257c892fc657c49c0d08480493e9356e Mon Sep 17 00:00:00 2001 From: devops Date: Thu, 24 Oct 2024 11:24:10 +0000 Subject: [PATCH 2/6] Updating README.md via GithubActions (helm-docs) --- charts/dbp-moodle/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/dbp-moodle/README.md b/charts/dbp-moodle/README.md index d0b57e1..a425ca9 100644 --- a/charts/dbp-moodle/README.md +++ b/charts/dbp-moodle/README.md @@ -83,7 +83,7 @@ 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":""},"retention_time":"","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.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 | From c9c9eae23a55b538841552df30022e6f3983585f Mon Sep 17 00:00:00 2001 From: marhode Date: Thu, 24 Oct 2024 16:21:45 +0200 Subject: [PATCH 3/6] Added max full backup age to values --- charts/dbp-moodle/templates/_helpers.tpl | 4 ++++ charts/dbp-moodle/templates/configmaps/duply-configmap.yaml | 2 +- charts/dbp-moodle/values.yaml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/dbp-moodle/templates/_helpers.tpl b/charts/dbp-moodle/templates/_helpers.tpl index ca7dadf..a42a877 100644 --- a/charts/dbp-moodle/templates/_helpers.tpl +++ b/charts/dbp-moodle/templates/_helpers.tpl @@ -51,6 +51,10 @@ {{- 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 840a092..212bbc0 100644 --- a/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml +++ b/charts/dbp-moodle/templates/configmaps/duply-configmap.yaml @@ -13,7 +13,7 @@ data: TARGET="boto3+s3://{{ .Values.dbpMoodle.backup.s3_bucket_name }}/{{ .Values.dbpMoodle.backup.cluster_name }}/{{ .Release.Namespace }}/" SOURCE='/' MAX_AGE={{ include "dbpMoodle.backup.retention_time" . }} - MAX_FULLBKP_AGE=1W + 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 ee7cfd5..b260c9a 100644 --- a/charts/dbp-moodle/values.yaml +++ b/charts/dbp-moodle/values.yaml @@ -123,6 +123,7 @@ dbpMoodle: backup: enabled: false retention_time: "" + max_full_backup_age: "" gpg_key_names: "" gpgkeys: gpgkey.dbpinfra.pub.asc: "" From ad0df945e008400acb70e26c27b6f4479ad482c2 Mon Sep 17 00:00:00 2001 From: devops Date: Thu, 24 Oct 2024 14:23:57 +0000 Subject: [PATCH 4/6] Updating README.md via GithubActions (helm-docs) --- charts/dbp-moodle/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/dbp-moodle/README.md b/charts/dbp-moodle/README.md index a425ca9..5a89b9c 100644 --- a/charts/dbp-moodle/README.md +++ b/charts/dbp-moodle/README.md @@ -83,7 +83,7 @@ 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":""},"retention_time":"","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":"","retention_time":"","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.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 | From 1b2636cf883c1388225ed61bdea21666a31f979d Mon Sep 17 00:00:00 2001 From: marhode Date: Fri, 25 Oct 2024 15:39:40 +0200 Subject: [PATCH 5/6] Added suggested changes in comments and default values --- charts/dbp-moodle/values.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/charts/dbp-moodle/values.yaml b/charts/dbp-moodle/values.yaml index b260c9a..7a9d5f2 100644 --- a/charts/dbp-moodle/values.yaml +++ b/charts/dbp-moodle/values.yaml @@ -122,8 +122,10 @@ dbpMoodle: # -- Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials backup: enabled: false - retention_time: "" - max_full_backup_age: "" + # -- 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: "" From 2046b46607ab232d8f1ec0364593912f4c37c58d Mon Sep 17 00:00:00 2001 From: devops Date: Fri, 25 Oct 2024 13:39:57 +0000 Subject: [PATCH 6/6] Updating README.md via GithubActions (helm-docs) --- charts/dbp-moodle/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/dbp-moodle/README.md b/charts/dbp-moodle/README.md index 5a89b9c..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":""},"max_full_backup_age":"","retention_time":"","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 |