diff --git a/charts/velero/Chart.yaml b/charts/velero/Chart.yaml index 1d10125a..bbc4d84c 100644 --- a/charts/velero/Chart.yaml +++ b/charts/velero/Chart.yaml @@ -3,7 +3,7 @@ appVersion: 1.11.0 kubeVersion: ">=1.16.0-0" description: A Helm chart for velero name: velero -version: 3.2.0 +version: 4.0.0 home: https://github.com/vmware-tanzu/velero icon: https://cdn-images-1.medium.com/max/1600/1*-9mb3AKnKdcL_QD3CMnthQ.png sources: diff --git a/charts/velero/README.md b/charts/velero/README.md index 072f16de..3c5659c4 100644 --- a/charts/velero/README.md +++ b/charts/velero/README.md @@ -46,12 +46,13 @@ helm install velero vmware-tanzu/velero \ --namespace \ --create-namespace \ --set-file credentials.secretContents.cloud= \ ---set configuration.provider= \ ---set configuration.backupStorageLocation.name= \ ---set configuration.backupStorageLocation.bucket= \ ---set configuration.backupStorageLocation.config.region= \ ---set configuration.volumeSnapshotLocation.name= \ ---set configuration.volumeSnapshotLocation.config.region= \ +--set configuration.backupStorageLocation[0].name= \ +--set configuration.backupStorageLocation[0].provider= \ +--set configuration.backupStorageLocation[0].bucket= \ +--set configuration.backupStorageLocation[0].config.region= \ +--set configuration.volumeSnapshotLocation[0].name= \ +--set configuration.volumeSnapshotLocation[0].provider= \ +--set configuration.volumeSnapshotLocation[0].config.region= \ --set initContainers[0].name=velero-plugin-for- \ --set initContainers[0].image=velero/velero-plugin-for-: \ --set initContainers[0].volumeMounts[0].mountPath=/target \ diff --git a/charts/velero/ci/test-values.yaml b/charts/velero/ci/test-values.yaml index 198f1347..38278fb9 100644 --- a/charts/velero/ci/test-values.yaml +++ b/charts/velero/ci/test-values.yaml @@ -1,18 +1,31 @@ # Set provider name and backup storage location bucket name configuration: - provider: aws backupStorageLocation: - name: primary - bucket: velero + - name: backups-primary + bucket: velero-backups default: true + provider: aws + credential: + name: test-credential + key: test-key + config: + region: us-east-1 + profile: us-east-1-profile + - name: backups-secondary + bucket: velero-backups + provider: aws config: region: us-west-1 - profile: test + profile: us-west-1-profile volumeSnapshotLocation: + - name: ebs-us-east-1 provider: aws config: - bucket: velero - region: us-west-1 + region: us-east-1 + - name: portworx-cloud + provider: portworx + config: + type: cloud schedules: mybackup: diff --git a/charts/velero/templates/NOTES.txt b/charts/velero/templates/NOTES.txt index da5933a4..940c6be9 100644 --- a/charts/velero/templates/NOTES.txt +++ b/charts/velero/templates/NOTES.txt @@ -26,6 +26,18 @@ More info on the official site: https://velero.io/docs {{- $breaking_title = print $breaking_title "\n###### the `helm template` command. #####" }} {{- $breaking_title = print $breaking_title "\n#################################################################################" }} +{{- if typeIs "map[string]interface {}" .Values.configuration.backupStorageLocation }} +{{- $breaking = print $breaking "\n\nERROR: Please make .configuration.backupStorageLocation from map to slice" }} +{{- end }} + +{{- if typeIs "map[string]interface {}" .Values.configuration.volumeSnapshotLocation }} +{{- $breaking = print $breaking "\n\nERROR: Please make .configuration.volumeSnapshotLocation from map to slice" }} +{{- end }} + +{{- if hasKey .Values.configuration "provider" }} +{{- $breaking = print $breaking "\n\nREMOVED: .configuration.provider has been removed, instead each backupStorageLocation and volumeSnapshotLocation has a provider configured" }} +{{- end }} + {{- if hasKey .Values "resticTimeout" }} {{- $breaking = print $breaking "\n\nREMOVED: resticTimeout has been removed, and it is named fsBackupTimeout" }} {{- end }} diff --git a/charts/velero/templates/_helpers.tpl b/charts/velero/templates/_helpers.tpl index 9d74cdb3..beed7f71 100644 --- a/charts/velero/templates/_helpers.tpl +++ b/charts/velero/templates/_helpers.tpl @@ -75,42 +75,6 @@ Create the node-Agent priority class name. {{- end -}} {{- end -}} -{{/* -Create the backup storage location name -*/}} -{{- define "velero.backupStorageLocation.name" -}} -{{- with .Values.configuration.backupStorageLocation -}} -{{ default "default" .name }} -{{- end -}} -{{- end -}} - -{{/* -Create the backup storage location provider -*/}} -{{- define "velero.backupStorageLocation.provider" -}} -{{- with .Values.configuration -}} -{{ default .provider .backupStorageLocation.provider }} -{{- end -}} -{{- end -}} - -{{/* -Create the volume snapshot location name -*/}} -{{- define "velero.volumeSnapshotLocation.name" -}} -{{- with .Values.configuration.volumeSnapshotLocation -}} -{{ default "default" .name }} -{{- end -}} -{{- end -}} - -{{/* -Create the volume snapshot location provider -*/}} -{{- define "velero.volumeSnapshotLocation.provider" -}} -{{- with .Values.configuration -}} -{{ default .provider .volumeSnapshotLocation.provider }} -{{- end -}} -{{- end -}} - {{/* Kubernetes version Built-in object .Capabilities.KubeVersion.Minor can provide non-number output diff --git a/charts/velero/templates/backupstoragelocation.yaml b/charts/velero/templates/backupstoragelocation.yaml index c448652a..868ff370 100644 --- a/charts/velero/templates/backupstoragelocation.yaml +++ b/charts/velero/templates/backupstoragelocation.yaml @@ -1,24 +1,36 @@ {{- if .Values.backupsEnabled }} + +{{- if typeIs "[]interface {}" .Values.configuration.backupStorageLocation }} +{{- range .Values.configuration.backupStorageLocation }} +--- apiVersion: velero.io/v1 kind: BackupStorageLocation metadata: - name: {{ include "velero.backupStorageLocation.name" . }} - namespace: {{ .Release.Namespace }} + name: {{ .name | default "default" }} + namespace: {{ $.Release.Namespace }} annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + app.kubernetes.io/name: {{ include "velero.name" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + helm.sh/chart: {{ include "velero.chart" $ }} spec: - provider: {{ include "velero.backupStorageLocation.provider" . }} - {{- with .Values.configuration.backupStorageLocation.default }} + {{- if not (empty .credential) }} + credential: + {{- with .credential.name }} + name: {{ . }} + {{- end }} + {{- with .credential.key }} + key: {{ . }} + {{- end }} + {{- end }} + provider: {{ .provider }} + accessMode: {{ .accessMode | default "ReadWrite" }} + {{- with .default }} default: {{ . }} {{- end }} - accessMode: {{ .Values.configuration.backupStorageLocation.accessMode }} -{{- with .Values.configuration.backupStorageLocation }} objectStorage: bucket: {{ .bucket | quote }} {{- with .prefix }} @@ -35,3 +47,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }} diff --git a/charts/velero/templates/volumesnapshotlocation.yaml b/charts/velero/templates/volumesnapshotlocation.yaml index 4f43f5f7..4cd3f3cf 100644 --- a/charts/velero/templates/volumesnapshotlocation.yaml +++ b/charts/velero/templates/volumesnapshotlocation.yaml @@ -1,23 +1,29 @@ {{- if .Values.snapshotsEnabled }} + +{{- if typeIs "[]interface {}" .Values.configuration.volumeSnapshotLocation }} +{{- range .Values.configuration.volumeSnapshotLocation }} +--- apiVersion: velero.io/v1 kind: VolumeSnapshotLocation metadata: - name: {{ include "velero.volumeSnapshotLocation.name" . }} - namespace: {{ .Release.Namespace }} + name: {{ .name | default "default" }} + namespace: {{ $.Release.Namespace }} annotations: "helm.sh/hook": post-install,post-upgrade,post-rollback "helm.sh/hook-delete-policy": before-hook-creation labels: - app.kubernetes.io/name: {{ include "velero.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "velero.chart" . }} + app.kubernetes.io/name: {{ include "velero.name" $ }} + app.kubernetes.io/instance: {{ $.Release.Name }} + app.kubernetes.io/managed-by: {{ $.Release.Service }} + helm.sh/chart: {{ include "velero.chart" $ }} spec: - provider: {{ include "velero.volumeSnapshotLocation.provider" . }} -{{- with .Values.configuration.volumeSnapshotLocation.config }} + provider: {{ .provider }} +{{- with .config }} config: {{- range $key, $value := . }} {{- $key | nindent 4 }}: {{ $value | quote }} {{- end }} {{- end -}} {{- end }} +{{- end }} +{{- end }} diff --git a/charts/velero/values.yaml b/charts/velero/values.yaml index 6a29c848..a67b856d 100644 --- a/charts/velero/values.yaml +++ b/charts/velero/values.yaml @@ -233,15 +233,12 @@ cleanUpCRDs: false ## and additional server settings. ## configuration: - # Cloud provider being used (e.g. aws, azure, gcp). - provider: - - # Parameters for the `default` BackupStorageLocation. See - # https://velero.io/docs/v1.6/api-types/backupstoragelocation/ + # Parameters for the BackupStorageLocation(s). Configure multiple by adding other element(s) to the backupStorageLocation slice. + # See https://velero.io/docs/v1.6/api-types/backupstoragelocation/ backupStorageLocation: # name is the name of the backup storage location where backups should be stored. If a name is not provided, # a backup storage location will be created with the name "default". Optional. - name: + - name: # provider is the name for the backup storage location provider. If omitted # `configuration.provider` will be used instead. provider: @@ -256,6 +253,11 @@ configuration: # accessMode determines if velero can write to this backup storage location. Optional. # default to ReadWrite, ReadOnly is used during migrations and restores. accessMode: ReadWrite + credential: + # name of the secret used by this backupStorageLocation. + name: + # name of key that contains the secret data to be used. + key: # Additional provider-specific configuration. See link above # for details of required/optional fields for your provider. config: {} @@ -275,11 +277,11 @@ configuration: # flag. For Velero client Command like velero backup describe, velero backup logs needs to add the flag --insecure-skip-tls-verify # insecureSkipTLSVerify: - # Parameters for the `default` VolumeSnapshotLocation. See - # https://velero.io/docs/v1.6/api-types/volumesnapshotlocation/ + # Parameters for the VolumeSnapshotLocation(s). Configure multiple by adding other element(s) to the volumeSnapshotLocation slice. + # See https://velero.io/docs/v1.6/api-types/volumesnapshotlocation/ volumeSnapshotLocation: # name is the name of the volume snapshot location where snapshots are being taken. Required. - name: + - name: # provider is the name for the volume snapshot provider. If omitted # `configuration.provider` will be used instead. provider: @@ -499,6 +501,7 @@ nodeAgent: # useOwnerReferencesInBackup: false # template: # ttl: "240h" +# storageLocation: default # includedNamespaces: # - foo schedules: {}