Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backups): improve includedNamespaces and add docs #357

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion application/templates/backup.yaml
Original file line number Diff line number Diff line change
@@ -17,8 +17,10 @@ spec:
labelSelector:
matchLabels:
app.kubernetes.io/part-of: {{ include "application.name" . }}
{{- range $namespace := .Values.backup.includedNamespaces }}
includedNamespaces:
- {{ .Values.backup.includedNamespace | default ( include "application.namespace" . ) | quote }}
- {{ include "application.tplvalues.render" ( dict "value" $namespace "context" $ ) }}
{{- end }}
defaultVolumesToRestic: {{ .Values.backup.defaultVolumesToRestic }}
snapshotVolumes: {{ .Values.backup.snapshotVolumes }}
storageLocation: {{ .Values.backup.storageLocation | quote }}
24 changes: 24 additions & 0 deletions application/tests/backup_test.yaml
Original file line number Diff line number Diff line change
@@ -64,6 +64,30 @@ tests:
path: spec.ttl
value: "1h0m0s"

- it: includes correct includedNamespaces by default
set:
namespaceOverride: base-namespace
backup:
enabled: true
storageLocation: my-storage-location
asserts:
- equal:
path: spec.includedNamespaces
value: [base-namespace]

- it: includes correct includedNamespaces when defined
set:
namespaceOverride: base-namespace
backup:
enabled: true
includedNamespaces:
- my-namespace
storageLocation: my-storage-location
asserts:
- equal:
path: spec.includedNamespaces
value: [my-namespace]

- it: includes includedResources when defined
set:
backup:
6 changes: 5 additions & 1 deletion application/values.yaml
Original file line number Diff line number Diff line change
@@ -1193,7 +1193,6 @@ backup:
namespace:
# -- (object) Additional labels for Backup.
# @section -- Backup Parameters
includedNamespaces:
additionalLabels:
# grafanaDashboard: grafana-operator
# -- (object) Annotations for Backup.
@@ -1212,6 +1211,11 @@ backup:
# -- (string) How long the Backup should be retained for.
# @section -- Backup Parameters
ttl: "1h0m0s"
# -- (tpl/list) List of namespaces to include objects from.
# @default -- `[ {{ include "application.namespace" $ }} ]`
# @section -- Backup Parameters
includedNamespaces:
- '{{ include "application.namespace" $ }}'
# -- (list) List of resource types to include in the backup.
# @section -- Backup Parameters
includedResources: