diff --git a/helm/vitess/templates/_helpers.tpl b/helm/vitess/templates/_helpers.tpl index 2eea5419e6d..4d2233c7e08 100644 --- a/helm/vitess/templates/_helpers.tpl +++ b/helm/vitess/templates/_helpers.tpl @@ -105,21 +105,30 @@ export EXTRA_MY_CNF="$FLAVOR_MYCNF:/vtdataroot/tabletdata/report-host.cnf:/vt/co # backup flags - expects config.backup ############################# {{- define "backup-flags" -}} +{{- $backup := index . 0 -}} +{{- $caller := index . 1 -}} -{{ if .enabled }} +{{ with $backup }} + + {{ if .enabled }} + {{ if eq $caller "vttablet" }} -restore_from_backup + {{ end }} + -backup_storage_implementation=$VT_BACKUP_SERVICE -{{ if eq .backup_storage_implementation "gcs" }} + {{ if eq .backup_storage_implementation "gcs" }} -gcs_backup_storage_bucket=$VT_GCS_BACKUP_STORAGE_BUCKET -gcs_backup_storage_root=$VT_GCS_BACKUP_STORAGE_ROOT -{{ else if eq .backup_storage_implementation "s3" }} + {{ else if eq .backup_storage_implementation "s3" }} -s3_backup_aws_region=$VT_S3_BACKUP_AWS_REGION -s3_backup_storage_bucket=$VT_S3_BACKUP_STORAGE_BUCKET -s3_backup_storage_root=$VT_S3_BACKUP_STORAGE_ROOT -s3_backup_server_side_encryption=$VT_S3_BACKUP_SERVER_SIDE_ENCRYPTION -{{ end }} + {{ end }} + + {{ end }} {{ end }} diff --git a/helm/vitess/templates/_vtctld.tpl b/helm/vitess/templates/_vtctld.tpl index e7f69436052..e75ea0dd48a 100644 --- a/helm/vitess/templates/_vtctld.tpl +++ b/helm/vitess/templates/_vtctld.tpl @@ -101,7 +101,7 @@ spec: -topo_implementation="etcd2" -topo_global_server_address="etcd-global-client.{{ $namespace }}:2379" -topo_global_root=/vitess/global -{{ include "backup-flags" . | indent 16 }} +{{ include "backup-flags" (tuple $config.backup "vtctld") | indent 16 }} END_OF_COMMAND ) diff --git a/helm/vitess/templates/_vttablet.tpl b/helm/vitess/templates/_vttablet.tpl index 9617ef0b6a5..0f8de94150a 100644 --- a/helm/vitess/templates/_vttablet.tpl +++ b/helm/vitess/templates/_vttablet.tpl @@ -328,7 +328,7 @@ spec: -orc_api_url "http://orchestrator.{{ $namespace }}/api" -orc_discover_interval "5m" {{ end }} -{{ include "backup-flags" $config.backup | indent 8 }} +{{ include "backup-flags" (tuple $config.backup "vttablet") | indent 8 }} END_OF_COMMAND ) {{- end -}}