@@ -25,59 +25,75 @@ ClusterRole
25
25
{{- end -}}
26
26
{{- end -}}
27
27
28
- {{/*
29
- Construct a container image name from a registry, repository, tag, and digest.
30
- */}}
31
- {{- define "gloo.image" -}}
32
- {{- $image := printf "%s/%s" .registry .repository -}}
33
-
28
+ {{- define "gloo.image.repository" -}}
34
29
{{- /*
35
30
for fips or fips-distroless variants: add -fips to the image repo (name)
36
31
*/ -}}
32
+ {{- if .repository -}}
33
+ {{- $repository := .repository -}}
37
34
{{- if or .fips (has .variant (list "fips" "fips-distroless")) -}}
38
35
{{- $fipsSupportedImages := list "gloo-ee" "extauth-ee" "gloo-ee-envoy-wrapper" "rate-limit-ee" "discovery-ee" "sds-ee" -}}
39
36
{{- if (has .repository $fipsSupportedImages) -}}
40
- {{- $image = printf "%s-fips" $image -}}
37
+ {{- $repository = printf "%s-fips" $repository -}}
41
38
{{- end -}}{{- /* if (has .repository $fipsSupportedImages) */ -}}
42
39
{{- end -}}{{- /* if or .fips (has .variant (list "fips" "fips-distroless")) */ -}}
40
+ {{ $repository }}
41
+ {{- end -}}{{- /* if .repository */ -}}
42
+ {{- end -}}{{- /* define "gloo.image.repository" */ -}}
43
43
44
- {{- /*
45
- add tag, if it exists
46
- */ -}}
44
+ {{- define "gloo.image.tag" -}}
47
45
{{- if .tag -}}
48
- {{- $image = printf "%s:%s" $image .tag -}}
49
- {{- end -}}{{- /* if .tag */ -}}
50
-
46
+ {{- $tag := .tag -}}
51
47
{{- /*
52
48
for distroless or fips-distroless variants: add -distroless to the tag
53
49
*/ -}}
54
50
{{- if and .tag (has .variant (list "distroless" "fips-distroless")) -}}
55
51
{{- $distrolessSupportedImages := list "gloo" "gloo-envoy-wrapper" "discovery" "sds" "certgen" "kubectl" "access-logger" "ingress" "gloo-ee" "extauth-ee" "gloo-ee-envoy-wrapper" "rate-limit-ee" "discovery-ee" "sds-ee" "observability-ee" "caching-ee" -}}
56
52
{{- if (has .repository $distrolessSupportedImages) -}}
57
- {{- $image = printf "%s-distroless" $image -}} {{- /* Add distroless suffix to the tag since it contains the same binaries in a different container */ -}}
53
+ {{- $tag = printf "%s-distroless" $tag -}} {{- /* Add distroless suffix to the tag since it contains the same binaries in a different container */ -}}
58
54
{{- end -}}{{- /* if (has .repository $distrolessSupportedImages) */ -}}
59
55
{{- end -}}{{- /* if and .tag (has .variant (list "distroless" "fips-distroless")) */ -}}
56
+ {{ $tag }}
57
+ {{- end -}}{{- /* if .tag */ -}}
58
+ {{- end -}}{{- /* define "gloo.image.tag" */ -}}
60
59
61
- {{- /*
62
- add digest for the chosen variant, if it exists
63
- */ -}}
60
+ {{- define "gloo.image.digest" -}}
61
+ {{- $digest := "" -}}
64
62
{{- if or .fips (eq .variant "fips") -}}
65
63
{{- if .fipsDigest -}}
66
- {{- $image = printf "%s@%s" $image .fipsDigest -}}
64
+ {{- $digest = .fipsDigest -}}
67
65
{{- end -}}{{- /* if .fipsDigest */ -}}
68
66
{{- else if eq .variant "distroless" -}}
69
67
{{- if .distrolessDigest -}}
70
- {{- $image = printf "%s@%s" $image .distrolessDigest -}}
68
+ {{- $digest = .distrolessDigest -}}
71
69
{{- end -}}{{- /* if .distrolessDigest */ -}}
72
70
{{- else if eq .variant "fips-distroless" -}}
73
71
{{- if .fipsDistrolessDigest -}}
74
- {{- $image = printf "%s@%s" $image .fipsDistrolessDigest -}}
72
+ {{- $digest = .fipsDistrolessDigest -}}
75
73
{{- end -}}{{- /* if .fipsDistrolessDigest */ -}}
76
74
{{- else -}}
77
75
{{- if .digest -}}{{- /* standard image digest */ -}}
78
- {{- $image = printf "%s@%s" $image .digest -}}
76
+ {{- $digest = .digest -}}
79
77
{{- end -}}{{- /* if .digest */ -}}
80
78
{{- end -}}
79
+ {{ $digest }}
80
+ {{- end -}}{{- /* define "gloo.image.digest" */ -}}
81
+
82
+
83
+ {{/*
84
+ Construct a container image name from a registry, repository, tag, and digest.
85
+ */}}
86
+ {{- define "gloo.image" -}}
87
+ {{- $repository := include "gloo.image.repository" . -}}
88
+ {{- $image := printf "%s/%s" .registry $repository -}}
89
+ {{- $tag := include "gloo.image.tag" . -}}
90
+ {{- if $tag -}}
91
+ {{- $image = printf "%s:%s" $image $tag -}}
92
+ {{- end -}}{{- /* if .tag */ -}}
93
+ {{- $digest := include "gloo.image.digest" . -}}
94
+ {{- if $digest -}}
95
+ {{- $image = printf "%s@%s" $image $digest -}}
96
+ {{- end -}}{{- /* if .digest */ -}}
81
97
{{ $image }}
82
98
{{- end -}}{{- /* define "gloo.image" */ -}}
83
99
@@ -170,7 +186,7 @@ It takes 4 values:
170
186
.defaults - the default securityContext for the pod or container
171
187
.globalSec - global security settings, usually from .Values.global.securitySettings
172
188
.indent - the number of spaces to indent the output. If not set, the output will not be indented.
173
- The indentation argument is necessary because it is possible that no output will be rendered.
189
+ The indentation argument is necessary because it is possible that no output will be rendered.
174
190
If that happens and the caller handles the indentation the result will be a line of whitespace, which gets caught by the whitespace tests
175
191
176
192
Depending upon the value of .values.merge, the securityContext will be merged with the defaults or completely replaced.
@@ -234,7 +250,7 @@ It takes 4 values:
234
250
.podSecurityStandards - podSecurityStandard from values.yaml
235
251
.globalSec - global security settings, usually from .Values.global.securitySettings
236
252
.indent - the number of spaces to indent the output. If not set, the output will not be indented.
237
- The indentation argument is necessary because it is possible that no output will be rendered.
253
+ The indentation argument is necessary because it is possible that no output will be rendered.
238
254
If that happens and the caller handles the indentation the result will be a line of whitespace, which gets caught by the whitespace tests
239
255
240
256
If .podSecurityStandards.container.enableRestrictedContainerDefaults is true , the defaults will be set to a restricted set of values.
@@ -260,7 +276,7 @@ It takes 4 values:
260
276
{ {- end -} }
261
277
{ {- /* set default seccompProfileType */ -} }
262
278
263
- { {- $pss_restricted_defaults := dict
279
+ { {- $pss_restricted_defaults := dict
264
280
" runAsNonRoot" true
265
281
" capabilities" (dict " drop" (list " ALL" ))
266
282
" allowPrivilegeEscalation" false } }
@@ -280,7 +296,7 @@ It takes 4 values:
280
296
{ {- end -} }
281
297
{ {- end -} }
282
298
{ {- /* call general securityContext template */ -} }
283
- { {- include " gloo.securityContext" (dict
299
+ { {- include " gloo.securityContext" (dict
284
300
" values" $values
285
301
" defaults" $defaults
286
302
" indent" $indent
0 commit comments