J release changes
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / kong / charts / postgresql / charts / common / templates / _images.tpl
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 {{- $separator := ":" -}}
10 {{- $termination := .imageRoot.tag | toString -}}
11 {{- if .global }}
12     {{- if .global.imageRegistry }}
13      {{- $registryName = .global.imageRegistry -}}
14     {{- end -}}
15 {{- end -}}
16 {{- if .imageRoot.digest }}
17     {{- $separator = "@" -}}
18     {{- $termination = .imageRoot.digest | toString -}}
19 {{- end -}}
20 {{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
21 {{- end -}}
22
23 {{/*
24 Return the proper Docker Image Registry Secret Names (deprecated: use common.images.renderPullSecrets instead)
25 {{ include "common.images.pullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "global" .Values.global) }}
26 */}}
27 {{- define "common.images.pullSecrets" -}}
28   {{- $pullSecrets := list }}
29
30   {{- if .global }}
31     {{- range .global.imagePullSecrets -}}
32       {{- $pullSecrets = append $pullSecrets . -}}
33     {{- end -}}
34   {{- end -}}
35
36   {{- range .images -}}
37     {{- range .pullSecrets -}}
38       {{- $pullSecrets = append $pullSecrets . -}}
39     {{- end -}}
40   {{- end -}}
41
42   {{- if (not (empty $pullSecrets)) }}
43 imagePullSecrets:
44     {{- range $pullSecrets }}
45   - name: {{ . }}
46     {{- end }}
47   {{- end }}
48 {{- end -}}
49
50 {{/*
51 Return the proper Docker Image Registry Secret Names evaluating values as templates
52 {{ include "common.images.renderPullSecrets" ( dict "images" (list .Values.path.to.the.image1, .Values.path.to.the.image2) "context" $) }}
53 */}}
54 {{- define "common.images.renderPullSecrets" -}}
55   {{- $pullSecrets := list }}
56   {{- $context := .context }}
57
58   {{- if $context.Values.global }}
59     {{- range $context.Values.global.imagePullSecrets -}}
60       {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
61     {{- end -}}
62   {{- end -}}
63
64   {{- range .images -}}
65     {{- range .pullSecrets -}}
66       {{- $pullSecrets = append $pullSecrets (include "common.tplvalues.render" (dict "value" . "context" $context)) -}}
67     {{- end -}}
68   {{- end -}}
69
70   {{- if (not (empty $pullSecrets)) }}
71 imagePullSecrets:
72     {{- range $pullSecrets }}
73   - name: {{ . }}
74     {{- end }}
75   {{- end }}
76 {{- end -}}