8000 Allow to specify image with digest in helm chart (#2979) · nginx/kubernetes-ingress@f03f906 · GitHub
[go: up one dir, main page]

Skip to content

Commit f03f906

Browse files
authored
Allow to specify image with digest in helm chart (#2979)
Closes #2978
1 parent ec298bb commit f03f906

File tree

6 files changed

+20
-3
lines changed
Collapse file tree

6 files changed

+20
-3
lines changed

deployments/helm-chart/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Parameter | Description | Default
155155
`controller.hostNetwork` | Enables the Ingress Controller pods to use the host's network namespace. | false
156156
`controller.nginxDebug` | Enables debugging for NGINX. Uses the `nginx-debug` binary. Requires `error-log-level: debug` in the ConfigMap via `controller.config.entries`. | false
157157
`controller.logLevel` | The log level of the Ingress Controller. | 1
158+
`controller.image.digest ` | The image digest of the Ingress Controller. | None
158159
`controller.image.repository` | The image repository of the Ingress Controller. | nginx/nginx-ingress
159160
`controller.image.tag` | The tag of the Ingress Controller image. | 2.3.0
160161
`controller.image.pullPolicy` | The pull policy for the Ingress Controller image. | IfNotPresent

deployments/helm-chart/templates/_helpers.tpl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,15 @@ Expand app name.
7575
*/}}
7676
{{- define "nginx-ingress.appName" -}}
7777
{{- default (include "nginx-ingress.name" .) .Values.controller.name -}}
78-
{{- end -}}
78+
{{- end -}}
79+
80+
{{/*
81+
Expand image name.
82+
*/}}
83+
{{- define "nginx-ingress.image" -}}
84+
{{- if .Values.controller.image.digest -}}
85+
{{- printf "%s@%s" .Values.controller.image.repository .Values.controller.image.digest -}}
86+
{{- else -}}
87+
{{- printf "%s:%s" .Values.controller.image.repository .Values.controller.image.tag -}}
88+
{{- end -}}
89+
{{- end -}}

deployments/helm-chart/templates/controller-daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ spec:
6969
hostNetwork: {{ .Values.controller.hostNetwork }}
7070
containers:
7171
- name: {{ include "nginx-ingress.name" . }}
72-
image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
72+
image: {{ include "nginx-ingress.image" . }}
7373
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
7474
ports:
7575
- name: http

deployments/helm-chart/templates/controller-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ spec:
7373
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
7474
hostNetwork: {{ .Values.controller.hostNetwork }}
7575
containers:
76-
- image: "{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}"
76+
- image: {{ include "nginx-ingress.image" . }}
7777
name: {{ include "nginx-ingress.name" . }}
7878
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
7979
ports:

deployments/helm-chart/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ controller:
5151
## The tag of the Ingress Controller image.
5252
tag: "2.3.0"
5353

54+
## The digest of the Ingress Controller image.
55+
## If digest is specified it has precedence over tag and will be used instead
56+
# digest: "sha256:CHANGEME"
57+
5458
## The pull policy for the Ingress Controller image.
5559
pullPolicy: IfNotPresent
5660

docs/content/installation/installation-with-helm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
160160
|``controller.nginxDebug`` | Enables debugging for NGINX. Uses the ``nginx-debug`` binary. Requires ``error-log-level: debug`` in the ConfigMap via ``controller.config.entries``. | false |
161161
|``controller.logLevel`` | The log level of the Ingress Controller. | 1 |
162162
|``controller.image.repository`` | The image repository of the Ingress Controller. | nginx/nginx-ingress |
163+
|``controller.image.digest`` | The digest of the Ingress Controller image. Digest has precedence over tag | None |
163164
|``controller.image.tag`` | The tag of the Ingress Controller image. | 2.3.0 |
164165
|``controller.image.pullPolicy`` | The pull policy for the Ingress Controller image. | IfNotPresent |
165166
|``controller.config.name`` | The name of the ConfigMap used by the Ingress Controller. | Autogenerated |

0 commit comments

Comments
 (0)
0