diff --git a/library/common/templates/lib/cnpg/barmanObjectStore/_azure.tpl b/library/common/templates/lib/cnpg/barmanObjectStore/_azure.tpl index 1f636250..b5d96001 100644 --- a/library/common/templates/lib/cnpg/barmanObjectStore/_azure.tpl +++ b/library/common/templates/lib/cnpg/barmanObjectStore/_azure.tpl @@ -28,7 +28,11 @@ {{- if not $data.containerName -}} {{- fail (printf "CNPG %s - You need to specify [%s.azure.containerName] or [%s.destinationPath]" ($type | camelcase) $key $key) -}} {{- end -}} - {{- $destinationPath = (printf "https://%s.%s.core.windows.net/%s/%s/%s/cnpg" $data.storageAccount $data.serviceName $data.containerName (($data.path | default "/") | trimSuffix "/")) $rootCtx.Release.Name -}} + {{- if $data.path -}} + {{- $destinationPath = (printf "https://%s.%s.core.windows.net/%s/%s/%s/cnpg" $data.storageAccount $data.serviceName $data.containerName ($data.path | trimSuffix "/") $rootCtx.Release.Name) -}} + {{- else -}} + {{- $destinationPath = (printf "https://%s.%s.core.windows.net/%s/%s/cnpg" $data.storageAccount $data.serviceName $data.containerName $rootCtx.Release.Name) -}} + {{- end -}} {{- end }} endpointURL: {{ $endpointURL }} destinationPath: {{ $destinationPath }} diff --git a/library/common/templates/lib/cnpg/barmanObjectStore/_google.tpl b/library/common/templates/lib/cnpg/barmanObjectStore/_google.tpl index 0ff4d2ef..28cc5a27 100644 --- a/library/common/templates/lib/cnpg/barmanObjectStore/_google.tpl +++ b/library/common/templates/lib/cnpg/barmanObjectStore/_google.tpl @@ -27,7 +27,11 @@ {{- if not $data.bucket -}} {{- fail (printf "CNPG %s - You need to specify [%s.google.bucket] or [%s.destinationPath]" ($type | camelcase) $key $key) -}} {{- end -}} - {{- $destinationPath = (printf "gs://%s/%s/%s/cnpg" $data.bucket (($data.path | default "/") | trimSuffix "/")) $rootCtx.Release.Name -}} + {{- if $data.path -}} + {{- $destinationPath = (printf "gs://%s/%s/%s/cnpg" $data.bucket ($data.path | trimSuffix "/") $rootCtx.Release.Name) -}} + {{- else -}} + {{- $destinationPath = (printf "gs://%s/%s/cnpg" $data.bucket $rootCtx.Release.Name) -}} + {{- end -}} {{- end }} endpointURL: {{ $endpointURL }} destinationPath: {{ $destinationPath }} diff --git a/library/common/templates/lib/cnpg/barmanObjectStore/_s3.tpl b/library/common/templates/lib/cnpg/barmanObjectStore/_s3.tpl index 0c9a3763..d193c7c9 100644 --- a/library/common/templates/lib/cnpg/barmanObjectStore/_s3.tpl +++ b/library/common/templates/lib/cnpg/barmanObjectStore/_s3.tpl @@ -22,7 +22,11 @@ {{- if not $data.bucket -}} {{- fail (printf "CNPG %s - You need to specify [%s.s3.bucket] or [%s.destinationPath]" ($type | camelcase) $key $key) -}} {{- end -}} - {{- $destinationPath = (printf "s3://%s/%s/%s/cnpg" $data.bucket (($data.path | default "/") | trimSuffix "/")) $rootCtx.Release.Name -}} + {{- if $data.path -}} + {{- $destinationPath = (printf "s3://%s/%s/%s/cnpg" $data.bucket ($data.path | trimSuffix "/") $rootCtx.Release.Name ) -}} + {{- else -}} + {{- $destinationPath = (printf "s3://%s/%s/cnpg" $data.bucket $rootCtx.Release.Name) -}} + {{- end -}} {{- end -}} {{- if not $endpointURL -}} {{- if not $data.region -}} diff --git a/library/common/templates/spawner/_pvc.tpl b/library/common/templates/spawner/_pvc.tpl index cfc0c229..5f16778f 100644 --- a/library/common/templates/spawner/_pvc.tpl +++ b/library/common/templates/spawner/_pvc.tpl @@ -101,8 +101,14 @@ {{- $_ := set $volsyncData "repository" $volsyncSecretName -}} {{- $credentials := get $.Values.credentials $volsync.credentials -}} - {{- $resticrepository := printf "s3:%s/%s/%s/volsync/%s" $credentials.url $credentials.bucket ( $credentials.path | default "/" ) $.Release.Name $volsyncSecretName -}} - {{- $resticpassword := $credentials.encrKey -}} + + {{- if $credentials.path -}} + {{- $resticrepository := printf "s3:%s/%s/%s/volsync/%s" $credentials.url $credentials.bucket ( $credentials.path | trimSuffix "/" ) $.Release.Name $volsyncSecretName -}} + {{- else -}} + {{- $resticrepository := printf "s3:%s/%s/volsync/%s" $credentials.url $credentials.bucket $.Release.Name $volsyncSecretName -}} + {{- end -}} + + {{- $resticpassword := ( $credentials.encrKey | default $.Release.Name ) -}} {{- $s3id := $credentials.accessKey -}} {{- $s3key := $credentials.secretKey -}}