Skip to content

Commit 45fc886

Browse files
authored
Chart: Add global.image.registry. (#12028)
1 parent 3f6e6ae commit 45fc886

10 files changed

+49
-14
lines changed

charts/ingress-nginx/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
255255
| controller.admissionWebhooks.patch.image.digest | string | `"sha256:a320a50cc91bd15fd2d6fa6de58bd98c1bd64b9a6f926ce23a600d87043455a3"` | |
256256
| controller.admissionWebhooks.patch.image.image | string | `"ingress-nginx/kube-webhook-certgen"` | |
257257
| controller.admissionWebhooks.patch.image.pullPolicy | string | `"IfNotPresent"` | |
258-
| controller.admissionWebhooks.patch.image.registry | string | `"registry.k8s.io"` | |
259258
| controller.admissionWebhooks.patch.image.tag | string | `"v1.4.3"` | |
260259
| controller.admissionWebhooks.patch.labels | object | `{}` | Labels to be added to patch job resources |
261260
| controller.admissionWebhooks.patch.networkPolicy.enabled | bool | `false` | Enable 'networkPolicy' or not |
@@ -328,7 +327,6 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
328327
| controller.image.image | string | `"ingress-nginx/controller"` | |
329328
| controller.image.pullPolicy | string | `"IfNotPresent"` | |
330329
| controller.image.readOnlyRootFilesystem | bool | `false` | |
331-
| controller.image.registry | string | `"registry.k8s.io"` | |
332330
| controller.image.runAsGroup | int | `82` | This value must not be changed using the official image. uid=101(www-data) gid=82(www-data) groups=82(www-data) |
333331
| controller.image.runAsNonRoot | bool | `true` | |
334332
| controller.image.runAsUser | int | `101` | This value must not be changed using the official image. uid=101(www-data) gid=82(www-data) groups=82(www-data) |
@@ -491,7 +489,6 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
491489
| defaultBackend.image.image | string | `"defaultbackend-amd64"` | |
492490
| defaultBackend.image.pullPolicy | string | `"IfNotPresent"` | |
493491
| defaultBackend.image.readOnlyRootFilesystem | bool | `true` | |
494-
| defaultBackend.image.registry | string | `"registry.k8s.io"` | |
495492
| defaultBackend.image.runAsGroup | int | `65534` | |
496493
| defaultBackend.image.runAsNonRoot | bool | `true` | |
497494
| defaultBackend.image.runAsUser | int | `65534` | |
@@ -533,6 +530,7 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
533530
| defaultBackend.unhealthyPodEvictionPolicy | string | `""` | Eviction policy for unhealthy pods guarded by PodDisruptionBudget. Ref: https://kubernetes.io/blog/2023/01/06/unhealthy-pod-eviction-policy-for-pdbs/ |
534531
| defaultBackend.updateStrategy | object | `{}` | The update strategy to apply to the Deployment or DaemonSet # |
535532
| dhParam | string | `""` | A base64-encoded Diffie-Hellman parameter. This can be generated with: `openssl dhparam 4096 2> /dev/null | base64` # Ref: https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/ssl-dh-param |
533+
| global.image.registry | string | `"registry.k8s.io"` | Registry host to pull images from. |
536534
| imagePullSecrets | list | `[]` | Optional array of imagePullSecrets containing private registry credentials # Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ |
537535
| namespaceOverride | string | `""` | Override the deployment namespace; defaults to .Release.Namespace |
538536
| portNamePrefix | string | `""` | Prefix for TCP and UDP ports names in ingress controller service # Some cloud providers, like Yandex Cloud may have a requirements for a port name regex to support cloud load balancer integration |

charts/ingress-nginx/templates/admission-webhooks/job-patch/job-createSecret.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
{{- end }}
4343
containers:
4444
- name: create
45-
{{- with .Values.controller.admissionWebhooks.patch.image }}
45+
{{- with (merge .Values.controller.admissionWebhooks.patch.image .Values.global.image) }}
4646
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{ end }}:{{ .tag }}{{ if .digest }}@{{ .digest }}{{ end }}
4747
{{- end }}
4848
imagePullPolicy: {{ .Values.controller.admissionWebhooks.patch.image.pullPolicy }}

charts/ingress-nginx/templates/admission-webhooks/job-patch/job-patchWebhook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
{{- end }}
4343
containers:
4444
- name: patch
45-
{{- with .Values.controller.admissionWebhooks.patch.image }}
45+
{{- with (merge .Values.controller.admissionWebhooks.patch.image .Values.global.image) }}
4646
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{ end }}:{{ .tag }}{{ if .digest }}@{{ .digest }}{{ end }}
4747
{{- end }}
4848
imagePullPolicy: {{ .Values.controller.admissionWebhooks.patch.image.pullPolicy }}

charts/ingress-nginx/templates/controller-daemonset.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ spec:
7575
{{- end }}
7676
containers:
7777
- name: {{ .Values.controller.containerName }}
78-
{{- with .Values.controller.image }}
78+
{{- with (merge .Values.controller.image .Values.global.image) }}
7979
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ include "ingress-nginx.image" . }}{{ end }}:{{ .tag }}{{ include "ingress-nginx.imageDigest" . }}
8080
{{- end }}
8181
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
@@ -182,7 +182,7 @@ spec:
182182
{{- if .Values.controller.extraModules }}
183183
{{- range .Values.controller.extraModules }}
184184
{{- $containerSecurityContext := .containerSecurityContext | default $.Values.controller.containerSecurityContext }}
185-
{{- include "extraModules" (dict "name" .name "image" .image "containerSecurityContext" $containerSecurityContext "resources" .resources) | nindent 8 }}
185+
{{- include "extraModules" (dict "name" .name "image" (merge .image $.Values.global.image) "containerSecurityContext" $containerSecurityContext "resources" .resources) | nindent 8 }}
186186
{{- end }}
187187
{{- end }}
188188
{{- end }}

charts/ingress-nginx/templates/controller-deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ spec:
8181
{{- end }}
8282
containers:
8383
- name: {{ .Values.controller.containerName }}
84-
{{- with .Values.controller.image }}
84+
{{- with (merge .Values.controller.image .Values.global.image) }}
8585
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ include "ingress-nginx.image" . }}{{ end }}:{{ .tag }}{{ include "ingress-nginx.imageDigest" . }}
8686
{{- end }}
8787
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
@@ -188,7 +188,7 @@ spec:
188188
{{- if .Values.controller.extraModules }}
189189
{{- range .Values.controller.extraModules }}
190190
{{- $containerSecurityContext := .containerSecurityContext | default $.Values.controller.containerSecurityContext }}
191-
{{- include "extraModules" (dict "name" .name "image" .image "containerSecurityContext" $containerSecurityContext "resources" .resources) | nindent 8 }}
191+
{{- include "extraModules" (dict "name" .name "image" (merge .image $.Values.global.image) "containerSecurityContext" $containerSecurityContext "resources" .resources) | nindent 8 }}
192192
{{- end }}
193193
{{- end }}
194194
{{- end }}

charts/ingress-nginx/templates/default-backend-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
{{- end }}
5151
containers:
5252
- name: {{ template "ingress-nginx.name" . }}-default-backend
53-
{{- with .Values.defaultBackend.image }}
53+
{{- with (merge .Values.defaultBackend.image .Values.global.image) }}
5454
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{ end }}:{{ .tag }}{{ if .digest }}@{{ .digest }}{{ end }}
5555
{{- end }}
5656
imagePullPolicy: {{ .Values.defaultBackend.image.pullPolicy }}

charts/ingress-nginx/tests/controller-daemonset_test.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,17 @@ tests:
148148
path: spec.template.spec.containers[0].securityContext.runAsGroup
149149
value: 1000
150150

151+
- it: should create a DaemonSet with a custom registry if `global.image.registry` is set
152+
set:
153+
global.image.registry: custom.registry.io
154+
controller.kind: DaemonSet
155+
controller.image.tag: v1.0.0-dev
156+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
157+
asserts:
158+
- equal:
159+
path: spec.template.spec.containers[0].image
160+
value: custom.registry.io/ingress-nginx/controller:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
161+
151162
- it: should create a DaemonSet with a custom registry if `controller.image.registry` is set
152163
set:
153164
controller.kind: DaemonSet

charts/ingress-nginx/tests/controller-deployment_test.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ tests:
169169
path: spec.template.spec.containers[0].securityContext.runAsGroup
170170
value: 1000
171171

172+
- it: should create a Deployment with a custom registry if `global.image.registry` is set
173+
set:
174+
global.image.registry: custom.registry.io
175+
controller.image.tag: v1.0.0-dev
176+
controller.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
177+
asserts:
178+
- equal:
179+
path: spec.template.spec.containers[0].image
180+
value: custom.registry.io/ingress-nginx/controller:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
181+
172182
- it: should create a Deployment with a custom registry if `controller.image.registry` is set
173183
set:
174184
controller.image.registry: custom.registry.io

charts/ingress-nginx/tests/default-backend-deployment_test.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ tests:
145145
path: spec.template.spec.containers[0].securityContext.runAsGroup
146146
value: 1000
147147

148+
- it: should create a Deployment with a custom registry if `global.image.registry` is set
149+
set:
150+
global.image.registry: custom.registry.io
151+
defaultBackend.enabled: true
152+
defaultBackend.image.tag: v1.0.0-dev
153+
defaultBackend.image.digest: sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
154+
asserts:
155+
- equal:
156+
path: spec.template.spec.containers[0].image
157+
value: custom.registry.io/defaultbackend-amd64:v1.0.0-dev@sha256:faa2d18687f734994b6bd9e309e7a73852a81c30e1b8f63165fcd4f0a087e3cd
158+
148159
- it: should create a Deployment with a custom registry if `defaultBackend.image.registry` is set
149160
set:
150161
defaultBackend.enabled: true

charts/ingress-nginx/values.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
## Ref: https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/index.md
33
##
44

5+
global:
6+
image:
7+
# -- Registry host to pull images from.
8+
registry: registry.k8s.io
9+
510
## Overrides for generated resource names
611
# See templates/_helpers.tpl
712
# nameOverride:
@@ -21,7 +26,7 @@ controller:
2126
image:
2227
## Keep false as default for now!
2328
chroot: false
24-
registry: registry.k8s.io
29+
# registry: registry.k8s.io
2530
image: ingress-nginx/controller
2631
## for backwards compatibility consider setting the full image url via the repository value below
2732
## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
@@ -686,7 +691,7 @@ controller:
686691
extraModules: []
687692
# - name: mytestmodule
688693
# image:
689-
# registry: registry.k8s.io
694+
# # registry: registry.k8s.io
690695
# image: ingress-nginx/mytestmodule
691696
# ## for backwards compatibility consider setting the full image url via the repository value below
692697
# ## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
@@ -785,7 +790,7 @@ controller:
785790
patch:
786791
enabled: true
787792
image:
788-
registry: registry.k8s.io
793+
# registry: registry.k8s.io
789794
image: ingress-nginx/kube-webhook-certgen
790795
## for backwards compatibility consider setting the full image url via the repository value below
791796
## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail
@@ -942,7 +947,7 @@ defaultBackend:
942947
enabled: false
943948
name: defaultbackend
944949
image:
945-
registry: registry.k8s.io
950+
# registry: registry.k8s.io
946951
image: defaultbackend-amd64
947952
## for backwards compatibility consider setting the full image url via the repository value below
948953
## use *either* current default registry/image or repository format or installing chart by providing the values.yaml will fail

0 commit comments

Comments
 (0)