chore(volsync): clearer namings and usage

This commit is contained in:
Stavros kois
2024-04-30 10:55:46 +03:00
parent 77643ff018
commit e66199cec9
4 changed files with 14 additions and 15 deletions

View File

@@ -29,9 +29,9 @@
{{- fail (printf "CNPG %s - You need to specify [%s.azure.containerName] or [%s.destinationPath]" ($type | camelcase) $key $key) -}}
{{- end -}}
{{- 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) -}}
{{- $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) -}}
{{- $destinationPath = (printf "https://%s.%s.core.windows.net/%s/%s/cnpg" $data.storageAccount $data.serviceName $data.containerName $rootCtx.Release.Name) -}}
{{- end -}}
{{- end }}
endpointURL: {{ $endpointURL }}

View File

@@ -28,9 +28,9 @@
{{- fail (printf "CNPG %s - You need to specify [%s.google.bucket] or [%s.destinationPath]" ($type | camelcase) $key $key) -}}
{{- end -}}
{{- if $data.path -}}
{{- $destinationPath = (printf "gs://%s/%s/%s/cnpg" $data.bucket ($data.path | trimSuffix "/") $rootCtx.Release.Name) -}}
{{- $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) -}}
{{- $destinationPath = (printf "gs://%s/%s/cnpg" $data.bucket $rootCtx.Release.Name) -}}
{{- end -}}
{{- end }}
endpointURL: {{ $endpointURL }}

View File

@@ -23,9 +23,9 @@
{{- fail (printf "CNPG %s - You need to specify [%s.s3.bucket] or [%s.destinationPath]" ($type | camelcase) $key $key) -}}
{{- end -}}
{{- if $data.path -}}
{{- $destinationPath = (printf "s3://%s/%s/%s/cnpg" $data.bucket ($data.path | trimSuffix "/") $rootCtx.Release.Name ) -}}
{{- $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) -}}
{{- $destinationPath = (printf "s3://%s/%s/cnpg" $data.bucket $rootCtx.Release.Name) -}}
{{- end -}}
{{- end -}}
{{- if not $endpointURL -}}

View File

@@ -102,26 +102,25 @@
{{- $credentials := get $.Values.credentials $volsync.credentials -}}
{{- $resticrepository := printf "s3:%s/%s/%s/volsync/%s-volsync-%s" $credentials.url $credentials.bucket $.Release.Name $objectData.shortName $volsyncData.name -}}
{{- $baseRepo := printf "s3:%s/%s" $credentials.url $credentials.bucket -}}
{{- $repoSuffix := printf "%s/volsync/%s-volsync-%s" $.Release.Name $objectData.shortName $volsyncData.name -}}
{{- $resticrepository := printf "%s/%s" $baseRepo $repoSuffix -}}
{{- if $credentials.path -}}
{{- $resticrepository = printf "s3:%s/%s/%s/%s/volsync/%s-volsync-%s" $credentials.url $credentials.bucket ( $credentials.path | trimSuffix "/" ) $.Release.Name $objectData.shortName $volsyncData.name -}}
{{- $resticrepository = printf "%s/%s/%s" $baseRepo ($credentials.path | trimSuffix "/") $repoSuffix -}}
{{- end -}}
{{- $resticpassword := ( $credentials.encrKey | default $.Release.Name ) -}}
{{- $s3id := $credentials.accessKey -}}
{{- $s3key := $credentials.secretKey -}}
{{- $volsyncSecretData := (dict
"name" $volsyncSecretName
"labels" ($volsync.labels | default dict)
"annotations" ($volsync.annotations | default dict)
"data" (dict
"RESTIC_REPOSITORY" $resticrepository
"RESTIC_PASSWORD" $resticpassword
"AWS_ACCESS_KEY_ID" $s3id
"AWS_SECRET_ACCESS_KEY" $s3key
"RESTIC_PASSWORD" $credentials.encrKey
"AWS_ACCESS_KEY_ID" $credentials.accessKey
"AWS_SECRET_ACCESS_KEY" $credentials.secretKey
)
) -}}
{{- include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $volsyncSecretData) -}}
{{/* Create VolSync resources*/}}
{{- if $srcEnabled -}}