k8s/helm-charts/dashy/charts/common/templates/spawner/_imagePullSecret.tpl

42 lines
1.6 KiB
Smarty
Raw Normal View History

2023-11-16 19:42:02 +10:00
{{/* Image Pull Secrets Spawner */}}
{{/* Call this template:
{{ include "tc.v1.common.spawner.imagePullSecret" $ -}}
*/}}
{{- define "tc.v1.common.spawner.imagePullSecret" -}}
{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" $ -}}
{{- range $name, $imgPullSecret := .Values.imagePullSecret -}}
{{- if $imgPullSecret.enabled -}}
{{/* Create a copy of the configmap */}}
{{- $objectData := (mustDeepCopy $imgPullSecret) -}}
{{- $objectName := (printf "%s-%s" $fullname $name) -}}
{{/* Perform validations */}} {{/* Secrets have a max name length of 253 */}}
{{- include "tc.v1.common.lib.chart.names.validation" (dict "name" $objectName "length" 253) -}}
{{- include "tc.v1.common.lib.imagePullSecret.validation" (dict "objectData" $objectData) -}}
{{- include "tc.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "Image Pull Secret") -}}
{{- $data := include "tc.v1.common.lib.imagePullSecret.createData" (dict "rootCtx" $ "objectData" $objectData) -}}
{{/* Update the data */}}
{{- $_ := set $objectData "data" $data -}}
{{/* Set the type to Image Pull Secret */}}
{{- $_ := set $objectData "type" "imagePullSecret" -}}
{{/* Set the name of the image pull secret */}}
{{- $_ := set $objectData "name" $objectName -}}
{{- $_ := set $objectData "shortName" $name -}}
{{/* Call class to create the object */}}
{{- include "tc.v1.common.class.secret" (dict "rootCtx" $ "objectData" $objectData) -}}
{{- end -}}
{{- end -}}
{{- end -}}