helm-charts/charts/library/common/templates/lib/container/_validate.tpl
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 66389dec8b
feat(common): Release 2.0.1 (#193)
2023-10-03 09:24:41 +02:00

20 lines
955 B
Smarty

{{/*
Validate container values
*/}}
{{- define "bjw-s.common.lib.container.validate" -}}
{{- $rootContext := .rootContext -}}
{{- $controllerObject := .controllerObject -}}
{{- $containerObject := .containerObject -}}
{{- if not (kindIs "map" $containerObject.image) -}}
{{- fail (printf "Image required to be a dictionary with repository and tag fields. (controller %s, container %s)" $controllerObject.identifier $containerObject.identifier) }}
{{- end -}}
{{- if eq (dig "image" "repository" "" $containerObject) "" -}}
{{- fail (printf "No image repository specified for container. (controller %s, container %s)" $controllerObject.identifier $containerObject.identifier) }}
{{- end -}}
{{- if eq (dig "image" "tag" "" $containerObject) "" -}}
{{- fail (printf "No image tag specified for container. (controller %s, container %s)" $controllerObject.identifier $containerObject.identifier) }}
{{- end -}}
{{- end -}}