github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/helm/test/mysql/charts/common/templates/_images.tpl (about) 1 {{/* vim: set filetype=mustache: */}} 2 {{/* 3 Return the proper image name 4 {{ include "common.images.image" ( dict "imageRoot" .Values.path.to.the.image "global" $) }} 5 */}} 6 {{- define "common.images.image" -}} 7 {{- $registryName := .imageRoot.registry -}} 8 {{- $repositoryName := .imageRoot.repository -}} 9 {{- $tag := .imageRoot.tag | toString -}} 10 {{- if .global }} 11 {{- if .global.imageRegistry }} 12 {{- $registryName = .global.imageRegistry -}} 13 {{- end -}} 14 {{- end -}} 15 {{- if $registryName }} 16 {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} 17 {{- else -}} 18 {{- printf "%s:%s" $repositoryName $tag -}} 19 {{- end -}} 20 {{- end -}} 21 22 {{/* 23 Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead) 24 {{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }} 25 */}} 26 {{- define "common.images.pullSecrets" -}} 27 {{- $pullSecrets := list }} 28 29 {{- if .global }} 30 {{- range .global.imagePullSecrets -}} 31 {{- $pullSecrets = append $pullSecrets . -}} 32 {{- end -}} 33 {{- end -}} 34 35 {{- range .images -}} 36 {{- range .pullSecrets -}} 37 {{- $pullSecrets = append $pullSecrets . -}} 38 {{- end -}} 39 {{- end -}} 40 41 {{- if (not (empty $pullSecrets)) }} 42 imagePullSecrets: 43 {{- range $pullSecrets }} 44 - name: {{ . }} 45 {{- end }} 46 {{- end }} 47 {{- end -}} 48 49 {{/* 50 Return the proper Docker Image Registry Secret Names evaluating values as templates 51 {{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }} 52 */}} 53 {{- define "common.images.renderPullSecrets" -}} 54 {{- $pullSecrets := list }} 55 {{- $context := .context }} 56 57 {{- if $context.Values.global }} 58 {{- range $context.Values.global.imagePullSecrets -}} 59 {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} 60 {{- end -}} 61 {{- end -}} 62 63 {{- range .images -}} 64 {{- range .pullSecrets -}} 65 {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}} 66 {{- end -}} 67 {{- end -}} 68 69 {{- if (not (empty $pullSecrets)) }} 70 imagePullSecrets: 71 {{- range $pullSecrets }} 72 - name: {{ . }} 73 {{- end }} 74 {{- end }} 75 {{- end -}}