@@ -587,76 +587,3 @@ NO_PROXY: {{ .Values.global.noProxy | quote }}
587587 { {- $tpl -} }
588588 { {- end -} }
589589{ {- end -} }
590-
591-
592- { {- define " codefresh-gitops-runtime.image.name" -} }
593- { {/* Restoring root $ context */} }
594- { {- $ := .context -} }
595-
596- { {- $registryName := .image.registry -} }
597- { {- $repositoryName := .image.repository -} }
598- { {- $imageTag := .image.tag | toString -} }
599- { {- $imageDigest := .image.digest } }
600-
601- { {- if $.Values.global -} }
602- { {- if $.Values.global.imageRegistry -} }
603- { { $registryName = $.Values.global.imageRegistry } }
604- { {- end -} }
605- { {- end -} }
606-
607- { {- if $registryName -} }
608- { {- if $imageDigest } }
609- { {- printf " %s/%s:%s@%s" $registryName $repositoryName $imageTag $imageDigest -} }
610- { {- else } }
611- { {- printf " %s/%s:%s" $registryName $repositoryName $imageTag -} }
612- { {- end } }
613- { {- else } }
614- { {- if $imageDigest } }
615- { {- printf " %s:%s@%s" $repositoryName $imageTag $imageDigest -} }
616- { {- else } }
617- { {- printf " %s:%s" $repositoryName $imageTag -} }
618- { {- end } }
619- { {- end } }
620- { {- end } }
621-
622- { {- define " codefresh-gitops-runtime.env-vars" } }
623- { {- $ := .context } }
624- { {- if .Values } }
625- { {- if not (kindIs " map" .Values) } }
626- { { fail " ERROR: env block must be a map" } }
627- { {- end } }
628- { {- end } }
629- { {- $env := .Values } }
630- { {- $templatedEnv := include " codefresh-gitops-runtime.tplrender" (dict " Values" $env " context" $) | fromYaml } }
631- { {- range $name , $val := $templatedEnv } }
632- { {- if or (kindIs " string" $val ) (kindIs " bool" $val ) (kindIs " int" $val ) (kindIs " float64" $val ) } }
633- - name: { { $name } }
634- value: { { $val | quote } }
635- { {- else if kindIs " map" $val } }
636- { {- if hasKey $val " valueFrom" } }
637- { {- if or (hasKey $val .valueFrom " secretKeyRef" ) (hasKey $val .valueFrom " configMapKeyRef" ) (hasKey $val .valueFrom " fieldRef" ) } }
638- - name: { { $name } }
639- { {- $val | toYaml | nindent 2 } }
640- { {- else } }
641- { { fail " ERROR: Only secretKeyRef/configMapKeyRef/fieldRef are supported for valueFrom block for environment variables!" } }
642- { {- end} }
643- { {- else } }
644- { { fail " ERROR: Cannot generate environment variables only strings and valueFrom are supported!" } }
645- { {- end } }
646- { {- else } }
647- { { fail " ERROR: Only maps and string/int/bool are supported for environment variables!" } }
648- { {- end } }
649- { {- end } }
650- { {- end } }
651-
652- { {- define " codefresh-gitops-runtime.tplrender" -} }
653- { {- $tpl := .Values -} }
654- { {- if not (typeIs " string" $tpl ) -} }
655- { {- $tpl = toYaml $tpl -} }
656- { {- end -} }
657- { {- if contains " {{" $tpl -} }
658- { {- tpl $tpl .context } }
659- { {- else -} }
660- { {- $tpl -} }
661- { {- end -} }
662- { {- end -} }
0 commit comments