Skip to content

Commit 23adbbf

Browse files
committed
update: add support for 'imagePullSecrets' propagation by root helm chart, in case nfd serves as sub-chart
Signed-off-by: Ido Heyvi <[email protected]>
1 parent 6bd2254 commit 23adbbf

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

deployment/helm/node-feature-discovery/templates/_helpers.tpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,22 @@ Create the name of the service account which nfd-gc will use
105105
{{ default "default" .Values.gc.serviceAccount.name }}
106106
{{- end -}}
107107
{{- end -}}
108+
109+
{{/*
110+
imagePullSecrets helper - uses local values or falls back to global values
111+
*/}}
112+
{{- define "node-feature-discovery.imagePullSecrets" -}}
113+
{{- $imagePullSecrets := list -}}
114+
{{- if .Values.imagePullSecrets -}}
115+
{{- range .Values.imagePullSecrets -}}
116+
{{- $imagePullSecrets = append $imagePullSecrets . -}}
117+
{{- end -}}
118+
{{- else if and .Values.global .Values.global.imagePullSecrets -}}
119+
{{- range .Values.global.imagePullSecrets -}}
120+
{{- $imagePullSecrets = append $imagePullSecrets . -}}
121+
{{- end -}}
122+
{{- end -}}
123+
{{- if $imagePullSecrets -}}
124+
{{- $imagePullSecrets | toJson }}
125+
{{- end -}}
126+
{{- end -}}

deployment/helm/node-feature-discovery/templates/master.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ spec:
3333
{{- with .Values.priorityClassName }}
3434
priorityClassName: {{ . }}
3535
{{- end }}
36-
{{- with .Values.imagePullSecrets }}
37-
imagePullSecrets:
38-
{{- toYaml . | nindent 8 }}
39-
{{- end }}
36+
imagePullSecrets: {{ include "node-feature-discovery.imagePullSecrets" . }}
4037
serviceAccountName: {{ include "node-feature-discovery.master.serviceAccountName" . }}
4138
enableServiceLinks: false
4239
securityContext:

deployment/helm/node-feature-discovery/templates/nfd-gc.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ spec:
3333
{{- with .Values.priorityClassName }}
3434
priorityClassName: {{ . }}
3535
{{- end }}
36-
{{- with .Values.imagePullSecrets }}
37-
imagePullSecrets:
38-
{{- toYaml . | nindent 8 }}
39-
{{- end }}
36+
imagePullSecrets: {{ include "node-feature-discovery.imagePullSecrets" . }}
4037
securityContext:
4138
{{- toYaml .Values.gc.podSecurityContext | nindent 8 }}
4239
hostNetwork: {{ .Values.gc.hostNetwork }}

deployment/helm/node-feature-discovery/templates/post-delete-job.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ spec:
6767
role: prune
6868
spec:
6969
serviceAccountName: {{ include "node-feature-discovery.fullname" . }}-prune
70-
{{- with .Values.imagePullSecrets }}
71-
imagePullSecrets:
72-
{{- toYaml . | nindent 8 }}
73-
{{- end }}
70+
imagePullSecrets: {{ include "node-feature-discovery.imagePullSecrets" . }}
7471
containers:
7572
- name: nfd-master
7673
securityContext:

deployment/helm/node-feature-discovery/templates/topologyupdater.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ spec:
3333
{{- with .Values.priorityClassName }}
3434
priorityClassName: {{ . }}
3535
{{- end }}
36-
{{- with .Values.imagePullSecrets }}
37-
imagePullSecrets:
38-
{{- toYaml . | nindent 8 }}
39-
{{- end }}
36+
imagePullSecrets: {{ include "node-feature-discovery.imagePullSecrets" . }}
4037
securityContext:
4138
{{- toYaml .Values.topologyUpdater.podSecurityContext | nindent 8 }}
4239
hostNetwork: {{ .Values.topologyUpdater.hostNetwork }}

deployment/helm/node-feature-discovery/templates/worker.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ spec:
3636
{{- with .Values.priorityClassName }}
3737
priorityClassName: {{ . }}
3838
{{- end }}
39-
{{- with .Values.imagePullSecrets }}
40-
imagePullSecrets:
41-
{{- toYaml . | nindent 8 }}
42-
{{- end }}
39+
imagePullSecrets: {{ include "node-feature-discovery.imagePullSecrets" . }}
4340
serviceAccountName: {{ include "node-feature-discovery.worker.serviceAccountName" . }}
4441
securityContext:
4542
{{- toYaml .Values.worker.podSecurityContext | nindent 8 }}

docs/deployment/helm.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ Metrics are configured to be exposed using prometheus operator API's by
170170
default. If you want to expose metrics using the prometheus operator
171171
API's you need to install the prometheus operator in your cluster.
172172

173+
### Global parameters
174+
175+
| Name | Type | Default | Description |
176+
|---------------------------------------------|---------|----------------------------------|----------------------------------------------------------------------------------------------------------------------------|
177+
| `global.imagePullSecrets` | array | [] | An optional list of references to secrets with the same meaning as `imagePullSecrets`. If `imagePullSecrets` is specified, it takes precedence over `global.imagePullSecrets`. |
178+
173179
### Master pod parameters
174180

175181
| Name | Type | Default | Description |

0 commit comments

Comments
 (0)