no need to recheck fallbackDefaults, we set it from the spawner.

This commit is contained in:
Stavros kois
2024-03-10 02:05:29 +02:00
parent 88f0a32c2d
commit bea6024e5f
2 changed files with 9 additions and 14 deletions

View File

@@ -139,13 +139,9 @@
{{- if eq $imageType "Postgres" -}}
{{- $imageType = "" -}}
{{- end -}}
{{- $pgVersion := $rootCtx.Values.global.fallbackDefaults.pgVersion -}}
{{- with $objectData.pgVersion -}}
{{- $pgVersion = . -}}
{{- end -}}
{{/* Format is [postgresCustomNameVersionImage] */}}
{{- $imageKey := printf "postgres%s%sImage" $imageType $pgVersion -}}
{{- $imageKey := printf "postgres%s%sImage" $imageType $objectData.pgVersion -}}
{{- $imageValue := fromJson (include "tc.v1.common.lib.container.imageSelector" (dict "rootCtx" $rootCtx "objectData" (dict "imageSelector" $imageKey))) -}}
{{- $formatImage := printf "%s:%s" $imageValue.repository $imageValue.tag -}}

View File

@@ -8,16 +8,15 @@
{{- end -}}
{{- end -}}
{{- if (hasKey $objectData "version") -}}
{{- if not (kindIs "string" $objectData.pgVersion) -}}
{{/* We must ensure that this is a string, as it is used in image selector that require a string */}}
{{- fail (printf "CNPG - Expected [pgVersion] to be a string, but got [%s]" (kindOf $objectData.pgVersion)) -}}
{{- end -}}
{{/* Kinda imposibble to happen, as we explicitly set it to string on the spawner */}}
{{- if not (kindIs "string" $objectData.pgVersion) -}}
{{/* We must ensure that this is a string, as it is used in image selector that require a string */}}
{{- fail (printf "CNPG - Expected [pgVersion] to be a string, but got [%s]" (kindOf $objectData.pgVersion)) -}}
{{- end -}}
{{- $validVersions := (list "15" "16") -}}
{{- if not (mustHas $objectData.pgVersion $validVersions) -}}
{{- fail (printf "CNPG - Expected [pgVersion] to be one of [%s], but got [%s]" (join ", " $validVersions) $objectData.pgVersion) -}}
{{- end -}}
{{- $validVersions := (list "15" "16") -}}
{{- if not (mustHas $objectData.pgVersion $validVersions) -}}
{{- fail (printf "CNPG - Expected [pgVersion] to be one of [%s], but got [%s]" (join ", " $validVersions) $objectData.pgVersion) -}}
{{- end -}}
{{- if (hasKey $objectData "hibernate") -}}