From c5cd27d2024e619c9ae3f782fbac157cc5b7afdf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:08:38 +0000 Subject: [PATCH 01/24] Initial plan From 4c3c7826a2848fb5e6e32d9d28dfb8222fc5b33b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:13:53 +0000 Subject: [PATCH 02/24] Update Velero backup fields: replace defaultVolumesToRestic with defaultVolumesToFsBackup and add snapshotMoveData Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- README.md | 3 ++- application/templates/backup.yaml | 5 ++++- application/tests/backup_test.yaml | 20 +++++++++++++++++++- application/values.yaml | 7 +++++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6db3f445..91d3d2cd 100644 --- a/README.md +++ b/README.md @@ -386,8 +386,9 @@ helm delete --namespace test my-application | backup.namespace | string | `{{ .Release.Namespace }}` | Namespace for Backup. | | backup.additionalLabels | object | `nil` | Additional labels for Backup. | | backup.annotations | object | `nil` | Annotations for Backup. | -| backup.defaultVolumesToRestic | bool | `true` | Whether to use Restic to take snapshots of all pod volumes by default. | +| backup.defaultVolumesToFsBackup | bool | `true` | Whether to use filesystem backup to take snapshots of all pod volumes by default. | | backup.snapshotVolumes | bool | `true` | Whether to take snapshots of persistent volumes as part of the backup. | +| backup.snapshotMoveData | bool | `nil` | Whether to move the data of the snapshot after it's taken. | | backup.storageLocation | string | `nil` | Name of the backup storage location where the backup should be stored. | | backup.ttl | string | `"1h0m0s"` | How long the Backup should be retained for. | | backup.includedNamespaces | tpl/list | `[ {{ include "application.namespace" $ }} ]` | List of namespaces to include objects from. | diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index cd76c660..8dc31080 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -21,8 +21,11 @@ spec: includedNamespaces: - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} {{- end }} - defaultVolumesToRestic: {{ .Values.backup.defaultVolumesToRestic }} + defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} snapshotVolumes: {{ .Values.backup.snapshotVolumes }} +{{- if .Values.backup.snapshotMoveData }} + snapshotMoveData: {{ .Values.backup.snapshotMoveData }} +{{- end }} storageLocation: {{ .Values.backup.storageLocation | quote }} ttl: {{ .Values.backup.ttl }} {{- if .Values.backup.includedResources }} diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index 65eba461..5ab4bd4b 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -55,7 +55,7 @@ tests: storageLocation: my-storage-location asserts: - equal: - path: spec.defaultVolumesToRestic + path: spec.defaultVolumesToFsBackup value: true - equal: path: spec.snapshotVolumes @@ -115,3 +115,21 @@ tests: value: - secrets - configmaps + + - it: includes snapshotMoveData when defined + set: + backup: + enabled: true + snapshotMoveData: true + asserts: + - equal: + path: spec.snapshotMoveData + value: true + + - it: does not include snapshotMoveData when not defined + set: + backup: + enabled: true + asserts: + - notExists: + path: spec.snapshotMoveData diff --git a/application/values.yaml b/application/values.yaml index f0852d55..ace10e61 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1233,12 +1233,15 @@ backup: # @section -- Backup Parameters annotations: # key: value - # -- (bool) Whether to use Restic to take snapshots of all pod volumes by default. + # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. # @section -- Backup Parameters - defaultVolumesToRestic: true + defaultVolumesToFsBackup: true # -- (bool) Whether to take snapshots of persistent volumes as part of the backup. # @section -- Backup Parameters snapshotVolumes: true + # -- (bool) Whether to move the data of the snapshot after it's taken. + # @section -- Backup Parameters + snapshotMoveData: # -- (string) Name of the backup storage location where the backup should be stored. # @section -- Backup Parameters storageLocation: From 87fd82bf33a83cbfbcacccbe20f8a4f630b5d975 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:36:54 +0000 Subject: [PATCH 03/24] Add comprehensive Velero backup fields and improve documentation Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- application/templates/backup.yaml | 45 ++++++++ application/tests/backup_test.yaml | 176 +++++++++++++++++++++++++++++ application/values.yaml | 62 ++++++++++ 3 files changed, 283 insertions(+) diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index 8dc31080..fef2b8b6 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -14,9 +14,14 @@ metadata: {{ toYaml .Values.backup.annotations | indent 4 }} {{- end }} spec: +{{- if .Values.backup.labelSelector }} + labelSelector: +{{ toYaml .Values.backup.labelSelector | indent 4 }} +{{- else }} labelSelector: matchLabels: app.kubernetes.io/part-of: {{ include "application.name" . }} +{{- end }} {{- range $namespace := .Values.backup.includedNamespaces }} includedNamespaces: - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} @@ -25,9 +30,25 @@ spec: snapshotVolumes: {{ .Values.backup.snapshotVolumes }} {{- if .Values.backup.snapshotMoveData }} snapshotMoveData: {{ .Values.backup.snapshotMoveData }} +{{- end }} +{{- if .Values.backup.includeClusterResources }} + includeClusterResources: {{ .Values.backup.includeClusterResources }} +{{- end }} +{{- if .Values.backup.csiSnapshotTimeout }} + csiSnapshotTimeout: {{ .Values.backup.csiSnapshotTimeout | quote }} +{{- end }} +{{- if .Values.backup.datamover }} + datamover: {{ .Values.backup.datamover | quote }} +{{- end }} +{{- if .Values.backup.itemOperationTimeout }} + itemOperationTimeout: {{ .Values.backup.itemOperationTimeout | quote }} {{- end }} storageLocation: {{ .Values.backup.storageLocation | quote }} ttl: {{ .Values.backup.ttl }} +{{- if .Values.backup.volumeSnapshotLocations }} + volumeSnapshotLocations: +{{ toYaml .Values.backup.volumeSnapshotLocations | indent 4 }} +{{- end }} {{- if .Values.backup.includedResources }} includedResources: {{ toYaml .Values.backup.includedResources | indent 4 }} @@ -36,4 +57,28 @@ spec: excludedResources: {{ toYaml .Values.backup.excludedResources | indent 4 }} {{- end -}} +{{- if .Values.backup.includedClusterScopedResources }} + includedClusterScopedResources: +{{ toYaml .Values.backup.includedClusterScopedResources | indent 4 }} +{{- end -}} +{{- if .Values.backup.excludedClusterScopedResources }} + excludedClusterScopedResources: +{{ toYaml .Values.backup.excludedClusterScopedResources | indent 4 }} +{{- end -}} +{{- if .Values.backup.includedNamespaceScopedResources }} + includedNamespaceScopedResources: +{{ toYaml .Values.backup.includedNamespaceScopedResources | indent 4 }} +{{- end -}} +{{- if .Values.backup.excludedNamespaceScopedResources }} + excludedNamespaceScopedResources: +{{ toYaml .Values.backup.excludedNamespaceScopedResources | indent 4 }} +{{- end -}} +{{- if .Values.backup.excludedNamespaces }} + excludedNamespaces: +{{ toYaml .Values.backup.excludedNamespaces | indent 4 }} +{{- end -}} +{{- if .Values.backup.orderedResources }} + orderedResources: +{{ toYaml .Values.backup.orderedResources | indent 4 }} +{{- end -}} {{- end }} diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index 5ab4bd4b..d8bb180b 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -133,3 +133,179 @@ tests: asserts: - notExists: path: spec.snapshotMoveData + + - it: includes labelSelector when defined + set: + backup: + enabled: true + labelSelector: + matchLabels: + app: my-app + matchExpressions: + - key: environment + operator: In + values: + - production + asserts: + - equal: + path: spec.labelSelector.matchLabels.app + value: my-app + - equal: + path: spec.labelSelector.matchExpressions[0].key + value: environment + + - it: uses default labelSelector when not defined + set: + backup: + enabled: true + applicationName: my-app + asserts: + - equal: + path: spec.labelSelector.matchLabels + value: + app.kubernetes.io/part-of: my-app + + - it: includes includeClusterResources when defined + set: + backup: + enabled: true + includeClusterResources: true + asserts: + - equal: + path: spec.includeClusterResources + value: true + + - it: does not include includeClusterResources when not defined + set: + backup: + enabled: true + asserts: + - notExists: + path: spec.includeClusterResources + + - it: includes csiSnapshotTimeout when defined + set: + backup: + enabled: true + csiSnapshotTimeout: "10m" + asserts: + - equal: + path: spec.csiSnapshotTimeout + value: "10m" + + - it: includes datamover when defined + set: + backup: + enabled: true + datamover: "kopia" + asserts: + - equal: + path: spec.datamover + value: "kopia" + + - it: includes itemOperationTimeout when defined + set: + backup: + enabled: true + itemOperationTimeout: "1h" + asserts: + - equal: + path: spec.itemOperationTimeout + value: "1h" + + - it: includes volumeSnapshotLocations when defined + set: + backup: + enabled: true + volumeSnapshotLocations: + - default + - gp2 + asserts: + - equal: + path: spec.volumeSnapshotLocations + value: + - default + - gp2 + + - it: includes excludedNamespaces when defined + set: + backup: + enabled: true + excludedNamespaces: + - kube-system + - kube-public + asserts: + - equal: + path: spec.excludedNamespaces + value: + - kube-system + - kube-public + + - it: includes includedClusterScopedResources when defined + set: + backup: + enabled: true + includedClusterScopedResources: + - clusterroles + - clusterrolebindings + asserts: + - equal: + path: spec.includedClusterScopedResources + value: + - clusterroles + - clusterrolebindings + + - it: includes excludedClusterScopedResources when defined + set: + backup: + enabled: true + excludedClusterScopedResources: + - storageclasses + asserts: + - equal: + path: spec.excludedClusterScopedResources + value: + - storageclasses + + - it: includes includedNamespaceScopedResources when defined + set: + backup: + enabled: true + includedNamespaceScopedResources: + - deployments + - services + asserts: + - equal: + path: spec.includedNamespaceScopedResources + value: + - deployments + - services + + - it: includes excludedNamespaceScopedResources when defined + set: + backup: + enabled: true + excludedNamespaceScopedResources: + - secrets + - configmaps + asserts: + - equal: + path: spec.excludedNamespaceScopedResources + value: + - secrets + - configmaps + + - it: includes orderedResources when defined + set: + backup: + enabled: true + orderedResources: + deployments: + - my-deployment-1 + - my-deployment-2 + asserts: + - equal: + path: spec.orderedResources.deployments + value: + - my-deployment-1 + - my-deployment-2 diff --git a/application/values.yaml b/application/values.yaml index ace10e61..350e142d 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1233,6 +1233,17 @@ backup: # @section -- Backup Parameters annotations: # key: value + # -- (object) Label selector to filter resources to include in the backup. If not set, uses default app.kubernetes.io/part-of selector. + # @section -- Backup Parameters + labelSelector: + # matchLabels: + # app: my-app + # matchExpressions: + # - key: environment + # operator: In + # values: + # - production + # - staging # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. # @section -- Backup Parameters defaultVolumesToFsBackup: true @@ -1242,23 +1253,74 @@ backup: # -- (bool) Whether to move the data of the snapshot after it's taken. # @section -- Backup Parameters snapshotMoveData: + # -- (bool) Whether to include cluster-scoped resources in the backup. + # @section -- Backup Parameters + includeClusterResources: + # -- (string) Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). + # @section -- Backup Parameters + csiSnapshotTimeout: + # -- (string) Data mover to be used by the backup. If empty or "velero", the built-in data mover will be used. + # @section -- Backup Parameters + datamover: + # -- (string) Time to wait for asynchronous BackupItemAction operations (e.g., "1h"). + # @section -- Backup Parameters + itemOperationTimeout: # -- (string) Name of the backup storage location where the backup should be stored. # @section -- Backup Parameters storageLocation: # -- (string) How long the Backup should be retained for. # @section -- Backup Parameters ttl: "1h0m0s" + # -- (list) Names of VolumeSnapshotLocations associated with this backup. + # @section -- Backup Parameters + volumeSnapshotLocations: + # - my-volume-snapshot-location # -- (tpl/list) List of namespaces to include objects from. # @default -- `[ {{ include "application.namespace" $ }} ]` # @section -- Backup Parameters includedNamespaces: - '{{ include "application.namespace" $ }}' + # -- (list) List of namespaces to exclude from the backup. + # @section -- Backup Parameters + excludedNamespaces: + # - kube-system + # - kube-public # -- (list) List of resource types to include in the backup. # @section -- Backup Parameters includedResources: + # - deployments + # - services # -- (list) List of resource types to exclude from the backup. # @section -- Backup Parameters excludedResources: + # - secrets + # - configmaps + # -- (list) List of cluster-scoped resource types to include in the backup. + # @section -- Backup Parameters + includedClusterScopedResources: + # - clusterroles + # - clusterrolebindings + # -- (list) List of cluster-scoped resource types to exclude from the backup. + # @section -- Backup Parameters + excludedClusterScopedResources: + # - storageclasses + # - volumesnapshotclasses + # -- (list) List of namespace-scoped resource types to include in the backup. + # @section -- Backup Parameters + includedNamespaceScopedResources: + # - deployments + # - services + # -- (list) List of namespace-scoped resource types to exclude from the backup. + # @section -- Backup Parameters + excludedNamespaceScopedResources: + # - secrets + # - configmaps + # -- (object) Specifies the backup order of resources of specific Kind. The map key is the resource name and the value is a list of object names in the order they should be backed up. + # @section -- Backup Parameters + orderedResources: + # deployments: + # - my-deployment-1 + # - my-deployment-2 # -- ([list or object] of [tpl/object or tpl/string]) Extra K8s manifests to deploy. # Can be of type list or object. If object, keys are ignored and only values are used. The used values can be defined as object or string and are passed through tpl to render. From cfc6008608028d14effece2536141c9895d6335e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:50:20 +0000 Subject: [PATCH 04/24] Address feedback: remove labelSelector field, fix common labels usage, improve type checking, and update README Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- README.md | 11 +++++++++++ application/templates/backup.yaml | 11 +++-------- application/values.yaml | 11 ----------- helm-unittest.tar.gz | 0 4 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 helm-unittest.tar.gz diff --git a/README.md b/README.md index 91d3d2cd..5702cc4f 100644 --- a/README.md +++ b/README.md @@ -389,11 +389,22 @@ helm delete --namespace test my-application | backup.defaultVolumesToFsBackup | bool | `true` | Whether to use filesystem backup to take snapshots of all pod volumes by default. | | backup.snapshotVolumes | bool | `true` | Whether to take snapshots of persistent volumes as part of the backup. | | backup.snapshotMoveData | bool | `nil` | Whether to move the data of the snapshot after it's taken. | +| backup.includeClusterResources | bool | `nil` | Whether to include cluster-scoped resources in the backup. | +| backup.csiSnapshotTimeout | string | `nil` | Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). | +| backup.datamover | string | `nil` | Data mover to be used by the backup. If empty or "velero", the built-in data mover will be used. | +| backup.itemOperationTimeout | string | `nil` | Time to wait for asynchronous BackupItemAction operations (e.g., "1h"). | | backup.storageLocation | string | `nil` | Name of the backup storage location where the backup should be stored. | | backup.ttl | string | `"1h0m0s"` | How long the Backup should be retained for. | +| backup.volumeSnapshotLocations | list | `nil` | Names of VolumeSnapshotLocations associated with this backup. | | backup.includedNamespaces | tpl/list | `[ {{ include "application.namespace" $ }} ]` | List of namespaces to include objects from. | +| backup.excludedNamespaces | list | `nil` | List of namespaces to exclude from the backup. | | backup.includedResources | list | `nil` | List of resource types to include in the backup. | | backup.excludedResources | list | `nil` | List of resource types to exclude from the backup. | +| backup.includedClusterScopedResources | list | `nil` | List of cluster-scoped resource types to include in the backup. | +| backup.excludedClusterScopedResources | list | `nil` | List of cluster-scoped resource types to exclude from the backup. | +| backup.includedNamespaceScopedResources | list | `nil` | List of namespace-scoped resource types to include in the backup. | +| backup.excludedNamespaceScopedResources | list | `nil` | List of namespace-scoped resource types to exclude from the backup. | +| backup.orderedResources | object | `nil` | Specifies the backup order of resources of specific Kind. The map key is the resource name and the value is a list of object names in the order they should be backed up. | ## Naming convention for ConfigMap, Secret, SealedSecret and ExternalSecret diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index fef2b8b6..05d705bf 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -14,24 +14,19 @@ metadata: {{ toYaml .Values.backup.annotations | indent 4 }} {{- end }} spec: -{{- if .Values.backup.labelSelector }} - labelSelector: -{{ toYaml .Values.backup.labelSelector | indent 4 }} -{{- else }} labelSelector: matchLabels: - app.kubernetes.io/part-of: {{ include "application.name" . }} -{{- end }} +{{ include "application.selectorLabels" . | indent 6 }} {{- range $namespace := .Values.backup.includedNamespaces }} includedNamespaces: - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} {{- end }} defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} snapshotVolumes: {{ .Values.backup.snapshotVolumes }} -{{- if .Values.backup.snapshotMoveData }} +{{- if not (kindIs "invalid" .Values.backup.snapshotMoveData) }} snapshotMoveData: {{ .Values.backup.snapshotMoveData }} {{- end }} -{{- if .Values.backup.includeClusterResources }} +{{- if not (kindIs "invalid" .Values.backup.includeClusterResources) }} includeClusterResources: {{ .Values.backup.includeClusterResources }} {{- end }} {{- if .Values.backup.csiSnapshotTimeout }} diff --git a/application/values.yaml b/application/values.yaml index 350e142d..6883489c 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1233,17 +1233,6 @@ backup: # @section -- Backup Parameters annotations: # key: value - # -- (object) Label selector to filter resources to include in the backup. If not set, uses default app.kubernetes.io/part-of selector. - # @section -- Backup Parameters - labelSelector: - # matchLabels: - # app: my-app - # matchExpressions: - # - key: environment - # operator: In - # values: - # - production - # - staging # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. # @section -- Backup Parameters defaultVolumesToFsBackup: true diff --git a/helm-unittest.tar.gz b/helm-unittest.tar.gz new file mode 100644 index 00000000..e69de29b From 86acf7c6fab0e571e008a0fc4b69c2d1b1971221 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 10:51:05 +0000 Subject: [PATCH 05/24] Clean up temporary files and update gitignore Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- .gitignore | 1 + helm-unittest.tar.gz | 0 2 files changed, 1 insertion(+) delete mode 100644 helm-unittest.tar.gz diff --git a/.gitignore b/.gitignore index 55340af3..c05e6dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .idea .vscode .project +helm-unittest.tar.gz diff --git a/helm-unittest.tar.gz b/helm-unittest.tar.gz deleted file mode 100644 index e69de29b..00000000 From 0d201a9990ebb9fa00811edf57d2d292361d2991 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:00:45 +0000 Subject: [PATCH 06/24] Remove specified backup fields and fix includedNamespaces multi-namespace support Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- README.md | 4 ---- application/templates/backup.yaml | 23 +++++++---------------- application/values.yaml | 22 ++++------------------ 3 files changed, 11 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 5702cc4f..b92c83d3 100644 --- a/README.md +++ b/README.md @@ -389,7 +389,6 @@ helm delete --namespace test my-application | backup.defaultVolumesToFsBackup | bool | `true` | Whether to use filesystem backup to take snapshots of all pod volumes by default. | | backup.snapshotVolumes | bool | `true` | Whether to take snapshots of persistent volumes as part of the backup. | | backup.snapshotMoveData | bool | `nil` | Whether to move the data of the snapshot after it's taken. | -| backup.includeClusterResources | bool | `nil` | Whether to include cluster-scoped resources in the backup. | | backup.csiSnapshotTimeout | string | `nil` | Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). | | backup.datamover | string | `nil` | Data mover to be used by the backup. If empty or "velero", the built-in data mover will be used. | | backup.itemOperationTimeout | string | `nil` | Time to wait for asynchronous BackupItemAction operations (e.g., "1h"). | @@ -397,11 +396,8 @@ helm delete --namespace test my-application | backup.ttl | string | `"1h0m0s"` | How long the Backup should be retained for. | | backup.volumeSnapshotLocations | list | `nil` | Names of VolumeSnapshotLocations associated with this backup. | | backup.includedNamespaces | tpl/list | `[ {{ include "application.namespace" $ }} ]` | List of namespaces to include objects from. | -| backup.excludedNamespaces | list | `nil` | List of namespaces to exclude from the backup. | | backup.includedResources | list | `nil` | List of resource types to include in the backup. | | backup.excludedResources | list | `nil` | List of resource types to exclude from the backup. | -| backup.includedClusterScopedResources | list | `nil` | List of cluster-scoped resource types to include in the backup. | -| backup.excludedClusterScopedResources | list | `nil` | List of cluster-scoped resource types to exclude from the backup. | | backup.includedNamespaceScopedResources | list | `nil` | List of namespace-scoped resource types to include in the backup. | | backup.excludedNamespaceScopedResources | list | `nil` | List of namespace-scoped resource types to exclude from the backup. | | backup.orderedResources | object | `nil` | Specifies the backup order of resources of specific Kind. The map key is the resource name and the value is a list of object names in the order they should be backed up. | diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index 05d705bf..dd330bd0 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -17,18 +17,18 @@ spec: labelSelector: matchLabels: {{ include "application.selectorLabels" . | indent 6 }} - {{- range $namespace := .Values.backup.includedNamespaces }} +{{- if .Values.backup.includedNamespaces }} includedNamespaces: + {{- range $namespace := .Values.backup.includedNamespaces }} - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} {{- end }} +{{- end }} defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} snapshotVolumes: {{ .Values.backup.snapshotVolumes }} {{- if not (kindIs "invalid" .Values.backup.snapshotMoveData) }} snapshotMoveData: {{ .Values.backup.snapshotMoveData }} {{- end }} -{{- if not (kindIs "invalid" .Values.backup.includeClusterResources) }} - includeClusterResources: {{ .Values.backup.includeClusterResources }} -{{- end }} + {{- if .Values.backup.csiSnapshotTimeout }} csiSnapshotTimeout: {{ .Values.backup.csiSnapshotTimeout | quote }} {{- end }} @@ -52,14 +52,8 @@ spec: excludedResources: {{ toYaml .Values.backup.excludedResources | indent 4 }} {{- end -}} -{{- if .Values.backup.includedClusterScopedResources }} - includedClusterScopedResources: -{{ toYaml .Values.backup.includedClusterScopedResources | indent 4 }} -{{- end -}} -{{- if .Values.backup.excludedClusterScopedResources }} - excludedClusterScopedResources: -{{ toYaml .Values.backup.excludedClusterScopedResources | indent 4 }} -{{- end -}} + + {{- if .Values.backup.includedNamespaceScopedResources }} includedNamespaceScopedResources: {{ toYaml .Values.backup.includedNamespaceScopedResources | indent 4 }} @@ -68,10 +62,7 @@ spec: excludedNamespaceScopedResources: {{ toYaml .Values.backup.excludedNamespaceScopedResources | indent 4 }} {{- end -}} -{{- if .Values.backup.excludedNamespaces }} - excludedNamespaces: -{{ toYaml .Values.backup.excludedNamespaces | indent 4 }} -{{- end -}} + {{- if .Values.backup.orderedResources }} orderedResources: {{ toYaml .Values.backup.orderedResources | indent 4 }} diff --git a/application/values.yaml b/application/values.yaml index 6883489c..5d234b96 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1242,9 +1242,7 @@ backup: # -- (bool) Whether to move the data of the snapshot after it's taken. # @section -- Backup Parameters snapshotMoveData: - # -- (bool) Whether to include cluster-scoped resources in the backup. - # @section -- Backup Parameters - includeClusterResources: + # -- (string) Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). # @section -- Backup Parameters csiSnapshotTimeout: @@ -1269,11 +1267,7 @@ backup: # @section -- Backup Parameters includedNamespaces: - '{{ include "application.namespace" $ }}' - # -- (list) List of namespaces to exclude from the backup. - # @section -- Backup Parameters - excludedNamespaces: - # - kube-system - # - kube-public + # -- (list) List of resource types to include in the backup. # @section -- Backup Parameters includedResources: @@ -1284,16 +1278,8 @@ backup: excludedResources: # - secrets # - configmaps - # -- (list) List of cluster-scoped resource types to include in the backup. - # @section -- Backup Parameters - includedClusterScopedResources: - # - clusterroles - # - clusterrolebindings - # -- (list) List of cluster-scoped resource types to exclude from the backup. - # @section -- Backup Parameters - excludedClusterScopedResources: - # - storageclasses - # - volumesnapshotclasses + + # -- (list) List of namespace-scoped resource types to include in the backup. # @section -- Backup Parameters includedNamespaceScopedResources: From eef0bfb4532d4e732814e41627c8965ec0180b81 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:03:40 +0000 Subject: [PATCH 07/24] Remove .gitignore change for helm-unittest.tar.gz Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index c05e6dbd..55340af3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ .idea .vscode .project -helm-unittest.tar.gz From c9637707610089abca4708ae39b3a72951046fd5 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:13:52 +0200 Subject: [PATCH 08/24] Update backup.yaml --- application/templates/backup.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index dd330bd0..a8831e54 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -28,7 +28,6 @@ spec: {{- if not (kindIs "invalid" .Values.backup.snapshotMoveData) }} snapshotMoveData: {{ .Values.backup.snapshotMoveData }} {{- end }} - {{- if .Values.backup.csiSnapshotTimeout }} csiSnapshotTimeout: {{ .Values.backup.csiSnapshotTimeout | quote }} {{- end }} @@ -52,8 +51,6 @@ spec: excludedResources: {{ toYaml .Values.backup.excludedResources | indent 4 }} {{- end -}} - - {{- if .Values.backup.includedNamespaceScopedResources }} includedNamespaceScopedResources: {{ toYaml .Values.backup.includedNamespaceScopedResources | indent 4 }} @@ -62,7 +59,6 @@ spec: excludedNamespaceScopedResources: {{ toYaml .Values.backup.excludedNamespaceScopedResources | indent 4 }} {{- end -}} - {{- if .Values.backup.orderedResources }} orderedResources: {{ toYaml .Values.backup.orderedResources | indent 4 }} From e8a17f3efa411e797070716fae4d9e06710f119a Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:14:13 +0200 Subject: [PATCH 09/24] Update values.yaml --- application/values.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/application/values.yaml b/application/values.yaml index 5d234b96..f32ab8df 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1242,7 +1242,6 @@ backup: # -- (bool) Whether to move the data of the snapshot after it's taken. # @section -- Backup Parameters snapshotMoveData: - # -- (string) Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). # @section -- Backup Parameters csiSnapshotTimeout: @@ -1267,7 +1266,6 @@ backup: # @section -- Backup Parameters includedNamespaces: - '{{ include "application.namespace" $ }}' - # -- (list) List of resource types to include in the backup. # @section -- Backup Parameters includedResources: @@ -1278,8 +1276,6 @@ backup: excludedResources: # - secrets # - configmaps - - # -- (list) List of namespace-scoped resource types to include in the backup. # @section -- Backup Parameters includedNamespaceScopedResources: From d266b196764334ed116a9c39aca199333ecbe93f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:22:48 +0000 Subject: [PATCH 10/24] Fix backup unit tests after field removal Co-authored-by: aslafy-z <8191198+aslafy-z@users.noreply.github.com> --- application/tests/backup_test.yaml | 81 ++---------------------------- 1 file changed, 5 insertions(+), 76 deletions(-) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index d8bb180b..b340c10f 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -134,27 +134,7 @@ tests: - notExists: path: spec.snapshotMoveData - - it: includes labelSelector when defined - set: - backup: - enabled: true - labelSelector: - matchLabels: - app: my-app - matchExpressions: - - key: environment - operator: In - values: - - production - asserts: - - equal: - path: spec.labelSelector.matchLabels.app - value: my-app - - equal: - path: spec.labelSelector.matchExpressions[0].key - value: environment - - - it: uses default labelSelector when not defined + - it: uses application selector labels set: backup: enabled: true @@ -163,25 +143,8 @@ tests: - equal: path: spec.labelSelector.matchLabels value: - app.kubernetes.io/part-of: my-app - - - it: includes includeClusterResources when defined - set: - backup: - enabled: true - includeClusterResources: true - asserts: - - equal: - path: spec.includeClusterResources - value: true + app.kubernetes.io/name: my-app - - it: does not include includeClusterResources when not defined - set: - backup: - enabled: true - asserts: - - notExists: - path: spec.includeClusterResources - it: includes csiSnapshotTimeout when defined set: @@ -227,45 +190,11 @@ tests: - default - gp2 - - it: includes excludedNamespaces when defined - set: - backup: - enabled: true - excludedNamespaces: - - kube-system - - kube-public - asserts: - - equal: - path: spec.excludedNamespaces - value: - - kube-system - - kube-public - - it: includes includedClusterScopedResources when defined - set: - backup: - enabled: true - includedClusterScopedResources: - - clusterroles - - clusterrolebindings - asserts: - - equal: - path: spec.includedClusterScopedResources - value: - - clusterroles - - clusterrolebindings - - it: includes excludedClusterScopedResources when defined - set: - backup: - enabled: true - excludedClusterScopedResources: - - storageclasses - asserts: - - equal: - path: spec.excludedClusterScopedResources - value: - - storageclasses + + + - it: includes includedNamespaceScopedResources when defined set: From d1dd157e5acafe796cbe3e6e2ef35839b27caa14 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:32:26 +0200 Subject: [PATCH 11/24] Update backup_test.yaml --- application/tests/backup_test.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index b340c10f..a09597fc 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -145,7 +145,6 @@ tests: value: app.kubernetes.io/name: my-app - - it: includes csiSnapshotTimeout when defined set: backup: @@ -190,12 +189,6 @@ tests: - default - gp2 - - - - - - - it: includes includedNamespaceScopedResources when defined set: backup: From 651bd83e2c1da9727e93ec3035dd991c71cc0ed6 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:56:50 +0200 Subject: [PATCH 12/24] Update values.yaml --- application/values.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/values.yaml b/application/values.yaml index f32ab8df..bedd65fb 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1233,6 +1233,10 @@ backup: # @section -- Backup Parameters annotations: # key: value + # -- (bool) Whether to use Restic to take snapshots of all pod volumes by default. + # Deprecated: Use `defaultVolumesToFsBackup` instead. + # @section -- Backup Parameters + defaultVolumesToRestic: true # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. # @section -- Backup Parameters defaultVolumesToFsBackup: true From 1e3d9da3ccf90491402ed4a4f38660c19bdd76de Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:57:46 +0200 Subject: [PATCH 13/24] Update backup_test.yaml --- application/tests/backup_test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index a09597fc..43588b6d 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -54,6 +54,9 @@ tests: namespace: my-namespace storageLocation: my-storage-location asserts: + - equal: + path: spec.defaultVolumesToRestic + value: true - equal: path: spec.defaultVolumesToFsBackup value: true From d54b159da1d3daa86c35a7b404d78ba209cc9c95 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 13:58:31 +0200 Subject: [PATCH 14/24] Update values.yaml --- application/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/values.yaml b/application/values.yaml index bedd65fb..effcbc3c 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1236,7 +1236,7 @@ backup: # -- (bool) Whether to use Restic to take snapshots of all pod volumes by default. # Deprecated: Use `defaultVolumesToFsBackup` instead. # @section -- Backup Parameters - defaultVolumesToRestic: true + defaultVolumesToRestic: # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. # @section -- Backup Parameters defaultVolumesToFsBackup: true From 5b3c48acc553774319bfbd0f41b972b374caf537 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 14:01:36 +0200 Subject: [PATCH 15/24] Update backup_test.yaml --- application/tests/backup_test.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index 43588b6d..fae8c4db 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -54,9 +54,8 @@ tests: namespace: my-namespace storageLocation: my-storage-location asserts: - - equal: + - isNullOrEmpty: path: spec.defaultVolumesToRestic - value: true - equal: path: spec.defaultVolumesToFsBackup value: true From e4e0aeed0c79d2704a56c9eb738cbaec76f38662 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 14:24:33 +0200 Subject: [PATCH 16/24] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b92c83d3..cbc4fedc 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,7 @@ helm delete --namespace test my-application | backup.namespace | string | `{{ .Release.Namespace }}` | Namespace for Backup. | | backup.additionalLabels | object | `nil` | Additional labels for Backup. | | backup.annotations | object | `nil` | Annotations for Backup. | +| backup.defaultVolumesToRestic | bool | `nil` | Whether to use Restic to take snapshots of all pod volumes by default. Deprecated: Use `defaultVolumesToFsBackup` instead. | | backup.defaultVolumesToFsBackup | bool | `true` | Whether to use filesystem backup to take snapshots of all pod volumes by default. | | backup.snapshotVolumes | bool | `true` | Whether to take snapshots of persistent volumes as part of the backup. | | backup.snapshotMoveData | bool | `nil` | Whether to move the data of the snapshot after it's taken. | From 60c0eabf659ccfe3949f605a20660cd539ccd01c Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Tue, 19 Aug 2025 14:25:54 +0200 Subject: [PATCH 17/24] Update backup_test.yaml --- application/tests/backup_test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index fae8c4db..1a794302 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -54,7 +54,7 @@ tests: namespace: my-namespace storageLocation: my-storage-location asserts: - - isNullOrEmpty: + - notExists: path: spec.defaultVolumesToRestic - equal: path: spec.defaultVolumesToFsBackup From 60367329073f7ed2b641d9a149a705a4cee9cab1 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 15:26:56 +0200 Subject: [PATCH 18/24] Update backup.yaml --- application/templates/backup.yaml | 90 +++++++++++++++++-------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index a8831e54..3279bdbd 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -5,62 +5,72 @@ metadata: name: {{ printf "%s-backup" .Values.applicationName | trunc 63 | quote }} namespace: {{ .Values.backup.namespace | default ( include "application.namespace" . ) | quote }} labels: - {{- include "application.labels" $ | nindent 4 }} -{{- if .Values.backup.additionalLabels }} -{{ toYaml .Values.backup.additionalLabels | indent 4 }} -{{- end }} -{{- if .Values.backup.annotations }} + {{- include "application.labels" $ | nindent 4 }} + {{- if .Values.backup.additionalLabels }} + {{- toYaml .Values.backup.additionalLabels | nindent 4 }} + {{- end }} + {{- if .Values.backup.annotations }} annotations: -{{ toYaml .Values.backup.annotations | indent 4 }} -{{- end }} + {{- toYaml .Values.backup.annotations | nindent 4 }} + {{- end }} spec: labelSelector: matchLabels: -{{ include "application.selectorLabels" . | indent 6 }} -{{- if .Values.backup.includedNamespaces }} + {{- include "application.selectorLabels" . | nindent 6 }} + {{- if not (kindIs "invalid" .Values.backup.includedNamespaces) }} includedNamespaces: - {{- range $namespace := .Values.backup.includedNamespaces }} - - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} + {{- range $namespace := .Values.backup.includedNamespaces }} + - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} + {{- end }} {{- end }} -{{- end }} - defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} + {{- if not (kindIs "invalid" .Values.backup.defaultVolumesToFsBackup) }} + defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} + {{- else if not (kindIs "invalid" .Values.backup.defaultVolumesToRestic) }} + defaultVolumesToRestic: {{ .Values.backup.defaultVolumesToRestic }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.snapshotVolumes) }} snapshotVolumes: {{ .Values.backup.snapshotVolumes }} -{{- if not (kindIs "invalid" .Values.backup.snapshotMoveData) }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.snapshotMoveData) }} snapshotMoveData: {{ .Values.backup.snapshotMoveData }} -{{- end }} -{{- if .Values.backup.csiSnapshotTimeout }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.csiSnapshotTimeout) }} csiSnapshotTimeout: {{ .Values.backup.csiSnapshotTimeout | quote }} -{{- end }} -{{- if .Values.backup.datamover }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.datamover) }} datamover: {{ .Values.backup.datamover | quote }} -{{- end }} -{{- if .Values.backup.itemOperationTimeout }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.itemOperationTimeout) }} itemOperationTimeout: {{ .Values.backup.itemOperationTimeout | quote }} -{{- end }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.storageLocation) }} storageLocation: {{ .Values.backup.storageLocation | quote }} - ttl: {{ .Values.backup.ttl }} -{{- if .Values.backup.volumeSnapshotLocations }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.ttl) }} + ttl: {{ .Values.backup.ttl | quote }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.volumeSnapshotLocations) }} volumeSnapshotLocations: -{{ toYaml .Values.backup.volumeSnapshotLocations | indent 4 }} -{{- end }} -{{- if .Values.backup.includedResources }} + {{- toYaml .Values.backup.volumeSnapshotLocations | nindent 4 }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.includedResources) }} includedResources: -{{ toYaml .Values.backup.includedResources | indent 4 }} -{{- end -}} -{{- if .Values.backup.excludedResources }} + {{- toYaml .Values.backup.includedResources | nindent 4 }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.excludedResources) }} excludedResources: -{{ toYaml .Values.backup.excludedResources | indent 4 }} -{{- end -}} -{{- if .Values.backup.includedNamespaceScopedResources }} + {{- toYaml .Values.backup.excludedResources | nindent 4 }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.includedNamespaceScopedResources) }} includedNamespaceScopedResources: -{{ toYaml .Values.backup.includedNamespaceScopedResources | indent 4 }} -{{- end -}} -{{- if .Values.backup.excludedNamespaceScopedResources }} + {{- toYaml .Values.backup.includedNamespaceScopedResources | nindent 4 }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.excludedNamespaceScopedResources) }} excludedNamespaceScopedResources: -{{ toYaml .Values.backup.excludedNamespaceScopedResources | indent 4 }} -{{- end -}} -{{- if .Values.backup.orderedResources }} + {{- toYaml .Values.backup.excludedNamespaceScopedResources | nindent 4 }} + {{- end }} + {{- if not (kindIs "invalid" .Values.backup.orderedResources) }} orderedResources: -{{ toYaml .Values.backup.orderedResources | indent 4 }} -{{- end -}} + {{- toYaml .Values.backup.orderedResources | nindent 4 }} + {{- end }} {{- end }} From 975ac713ba4e3c82b16c5fbaea5214d33ef40b3c Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 15:29:36 +0200 Subject: [PATCH 19/24] Add test for explicit deprecated restic integration in backup --- application/tests/backup_test.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index 1a794302..fcfb1c32 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -66,6 +66,20 @@ tests: path: spec.ttl value: "1h0m0s" + - it: uses restic integration is explicitly enabled + set: + backup: + enabled: true + namespace: my-namespace + storageLocation: my-storage-location + defaultVolumesToRestic: true + asserts: + - notExists: + path: spec.defaultVolumesToFsBackup + - equal: + path: spec.defaultVolumesToRestic + value: true + - it: includes correct includedNamespaces by default set: namespaceOverride: base-namespace From 9c2d80947f572492ac7c87bbdbdd80c8946fc2ed Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 15:32:37 +0200 Subject: [PATCH 20/24] Reorder backup parameters in values.yaml --- application/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/values.yaml b/application/values.yaml index 1244c608..65ba2c78 100644 --- a/application/values.yaml +++ b/application/values.yaml @@ -1236,13 +1236,13 @@ backup: # @section -- Backup Parameters annotations: # key: value + # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. + # @section -- Backup Parameters + defaultVolumesToFsBackup: true # -- (bool) Whether to use Restic to take snapshots of all pod volumes by default. # Deprecated: Use `defaultVolumesToFsBackup` instead. # @section -- Backup Parameters defaultVolumesToRestic: - # -- (bool) Whether to use filesystem backup to take snapshots of all pod volumes by default. - # @section -- Backup Parameters - defaultVolumesToFsBackup: true # -- (bool) Whether to take snapshots of persistent volumes as part of the backup. # @section -- Backup Parameters snapshotVolumes: true From c8c4e2139299a831bdf57e8360ddf7a88ff137cb Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 15:35:33 +0200 Subject: [PATCH 21/24] Refactor conditional checks for backup volumes --- application/templates/backup.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index 3279bdbd..975d2d21 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -23,10 +23,10 @@ spec: - {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }} {{- end }} {{- end }} - {{- if not (kindIs "invalid" .Values.backup.defaultVolumesToFsBackup) }} - defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} - {{- else if not (kindIs "invalid" .Values.backup.defaultVolumesToRestic) }} + {{- if not (kindIs "invalid" .Values.backup.defaultVolumesToRestic) }} defaultVolumesToRestic: {{ .Values.backup.defaultVolumesToRestic }} + {{- else if not (kindIs "invalid" .Values.backup.defaultVolumesToFsBackup) }} + defaultVolumesToFsBackup: {{ .Values.backup.defaultVolumesToFsBackup }} {{- end }} {{- if not (kindIs "invalid" .Values.backup.snapshotVolumes) }} snapshotVolumes: {{ .Values.backup.snapshotVolumes }} From 3473a8af64444d62161acb9759581312403d153a Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 15:37:48 +0200 Subject: [PATCH 22/24] docs(README): Reorder backup options --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 331a95ee..b7c45329 100644 --- a/README.md +++ b/README.md @@ -387,8 +387,8 @@ helm delete --namespace test my-application | backup.namespace | string | `{{ .Release.Namespace }}` | Namespace for Backup. | | backup.additionalLabels | object | `nil` | Additional labels for Backup. | | backup.annotations | object | `nil` | Annotations for Backup. | -| backup.defaultVolumesToRestic | bool | `nil` | Whether to use Restic to take snapshots of all pod volumes by default. Deprecated: Use `defaultVolumesToFsBackup` instead. | | backup.defaultVolumesToFsBackup | bool | `true` | Whether to use filesystem backup to take snapshots of all pod volumes by default. | +| backup.defaultVolumesToRestic | bool | `nil` | Whether to use Restic to take snapshots of all pod volumes by default. Deprecated: Use `defaultVolumesToFsBackup` instead. | | backup.snapshotVolumes | bool | `true` | Whether to take snapshots of persistent volumes as part of the backup. | | backup.snapshotMoveData | bool | `nil` | Whether to move the data of the snapshot after it's taken. | | backup.csiSnapshotTimeout | string | `nil` | Time to wait for CSI VolumeSnapshot status to turn ReadyToUse during creation (e.g., "10m"). | From 4d6b1fb8d367e5a07607e40bd3137ac1d60656c3 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 16:41:33 +0200 Subject: [PATCH 23/24] fix: add capability guard --- application/templates/backup.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/templates/backup.yaml b/application/templates/backup.yaml index 975d2d21..82a11cad 100644 --- a/application/templates/backup.yaml +++ b/application/templates/backup.yaml @@ -1,4 +1,4 @@ -{{- if (.Values.backup).enabled }} +{{- if and .Values.backup .Values.backup.enabled (.Capabilities.APIVersions.Has "velero.io/v1") -}} apiVersion: velero.io/v1 kind: Backup metadata: From 731cc2e6ec20e2b395118c51caab7231a8a26c74 Mon Sep 17 00:00:00 2001 From: Zadkiel AHARONIAN Date: Sat, 13 Sep 2025 16:42:51 +0200 Subject: [PATCH 24/24] Update backup_test.yaml with capabilities section Add capabilities section with API versions for tests --- application/tests/backup_test.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/tests/backup_test.yaml b/application/tests/backup_test.yaml index fcfb1c32..5e92e318 100644 --- a/application/tests/backup_test.yaml +++ b/application/tests/backup_test.yaml @@ -3,6 +3,11 @@ suite: Backup templates: - backup.yaml +capabilities: + apiVersions: + - velero.io/v1 + - velero.io/v1/Backup + tests: - it: does not yield Backup resource if backup.enabled is false set: