Skip to content

Commit 930a53e

Browse files
tobiasgiesemarquiz
authored andcommitted
Add helm values to configure hostNetwork and additional env vars
We have to run our NFD workers in the host network. Also we need additional env variables such as KUBERNETES_SERVICE_HOST and _PORT. To achieve this we can simply add generic helm values. The default behavior is not changed. Signed-off-by: Tobias Giese <[email protected]> (cherry picked from commit af0592b)
1 parent 43b9f43 commit 930a53e

File tree

6 files changed

+42
-4
lines changed

6 files changed

+42
-4
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ spec:
3939
enableServiceLinks: false
4040
securityContext:
4141
{{- toYaml .Values.master.podSecurityContext | nindent 8 }}
42+
hostNetwork: {{ .Values.master.hostNetwork }}
4243
containers:
4344
- name: master
4445
securityContext:
@@ -54,11 +55,16 @@ spec:
5455
name: grpc
5556
- containerPort: {{ .Values.master.metricsPort | default "8081" }}
5657
name: metrics
58+
- containerPort: 8082
59+
name: health
5760
env:
5861
- name: NODE_NAME
5962
valueFrom:
6063
fieldRef:
6164
fieldPath: spec.nodeName
65+
{{- with .Values.master.extraEnvs }}
66+
{{- toYaml . | nindent 8 }}
67+
{{- end}}
6268
command:
6369
- "nfd-master"
6470
resources:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ spec:
3939
{{- end }}
4040
securityContext:
4141
{{- toYaml .Values.gc.podSecurityContext | nindent 8 }}
42+
hostNetwork: {{ .Values.gc.hostNetwork }}
4243
containers:
4344
- name: gc
4445
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -48,6 +49,9 @@ spec:
4849
valueFrom:
4950
fieldRef:
5051
fieldPath: spec.nodeName
52+
{{- with .Values.gc.extraEnvs }}
53+
{{- toYaml . | nindent 8 }}
54+
{{- end}}
5155
command:
5256
- "nfd-gc"
5357
args:

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838
{{- end }}
3939
securityContext:
4040
{{- toYaml .Values.topologyUpdater.podSecurityContext | nindent 8 }}
41+
hostNetwork: {{ .Values.topologyUpdater.hostNetwork }}
4142
containers:
4243
- name: topology-updater
4344
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -55,6 +56,9 @@ spec:
5556
valueFrom:
5657
fieldRef:
5758
fieldPath: status.hostIP
59+
{{- with .Values.topologyUpdater.extraEnvs }}
60+
{{- toYaml . | nindent 8 }}
61+
{{- end}}
5862
command:
5963
- "nfd-topology-updater"
6064
args:
@@ -87,8 +91,10 @@ spec:
8791
- -metrics={{ .Values.topologyUpdater.metricsPort | default "8081"}}
8892
- "-grpc-health={{ .Values.topologyUpdater.healthPort | default "8082" }}"
8993
ports:
90-
- name: metrics
91-
containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}}
94+
- containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}}
95+
name: metrics
96+
- containerPort: 8082
97+
name: health
9298
volumeMounts:
9399
{{- if .Values.topologyUpdater.kubeletConfigPath | empty | not }}
94100
- name: kubelet-config

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838
serviceAccountName: {{ include "node-feature-discovery.worker.serviceAccountName" . }}
3939
securityContext:
4040
{{- toYaml .Values.worker.podSecurityContext | nindent 8 }}
41+
hostNetwork: {{ .Values.worker.hostNetwork }}
4142
containers:
4243
- name: worker
4344
securityContext:
@@ -61,6 +62,9 @@ spec:
6162
valueFrom:
6263
fieldRef:
6364
fieldPath: metadata.uid
65+
{{- with .Values.worker.extraEnvs }}
66+
{{- toYaml . | nindent 8 }}
67+
{{- end}}
6468
resources:
6569
{{- toYaml .Values.worker.resources | nindent 12 }}
6670
command:
@@ -81,8 +85,10 @@ spec:
8185
- "-metrics={{ .Values.worker.metricsPort | default "8081"}}"
8286
- "-grpc-health={{ .Values.worker.healthPort | default "8082" }}"
8387
ports:
84-
- name: metrics
85-
containerPort: {{ .Values.worker.metricsPort | default "8081"}}
88+
- containerPort: {{ .Values.worker.metricsPort | default "8081"}}
89+
name: metrics
90+
- containerPort: 8082
91+
name: health
8692
volumeMounts:
8793
- name: host-boot
8894
mountPath: "/host-boot"

deployment/helm/node-feature-discovery/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ priorityClassName: ""
2020

2121
master:
2222
enable: true
23+
extraEnvs: []
24+
hostNetwork: false
2325
config: ### <NFD-MASTER-CONF-START-DO-NOT-REMOVE>
2426
# noPublish: false
2527
# autoDefaultNs: true
@@ -158,6 +160,8 @@ master:
158160

159161
worker:
160162
enable: true
163+
extraEnvs: []
164+
hostNetwork: false
161165
config: ### <NFD-WORKER-CONF-START-DO-NOT-REMOVE>
162166
#core:
163167
# labelWhiteList:
@@ -479,6 +483,8 @@ topologyUpdater:
479483

480484
enable: false
481485
createCRDs: false
486+
extraEnvs: []
487+
hostNetwork: false
482488

483489
serviceAccount:
484490
create: true
@@ -536,6 +542,8 @@ topologyUpdater:
536542

537543
gc:
538544
enable: true
545+
extraEnvs: []
546+
hostNetwork: false
539547
replicaCount: 1
540548

541549
serviceAccount:

docs/deployment/helm.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ API's you need to install the prometheus operator in your cluster.
178178
|-----------------------------|---------|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
179179
| `master.*` | dict | | NFD master deployment configuration |
180180
| `master.enable` | bool | true | Specifies whether nfd-master should be deployed |
181+
| `master.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
181182
| `master.port` | integer | | Specifies the TCP port that nfd-master listens for incoming requests. **NOTE**: this parameter is related to the deprecated gRPC API and will be removed with it in a future release |
182183
| `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator |
183184
| `master.healthPort` | integer | 8082 | Port on which to expose the grpc health endpoint |
@@ -205,6 +206,7 @@ API's you need to install the prometheus operator in your cluster.
205206
| `master.deploymentAnnotations` | dict | {} | NFD master deployment [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
206207
| `master.nfdApiParallelism` | integer | 10 | Specifies the maximum number of concurrent node updates. |
207208
| `master.config` | dict | | NFD master [configuration](../reference/master-configuration-reference) |
209+
| `master.extraEnvs` | array | [] | Additional environment variables to pass to nfd-master |
208210
| `master.revisionHistoryLimit` | integer | | Specify how many old ReplicaSets for this Deployment you want to retain. [revisionHistoryLimit](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#revision-history-limit) |
209211
| `master.livenessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":10} | NFD master pod [liveness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#liveness-probe) |
210212
| `master.readinessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":5,"failureThreshold": 10} | NFD master pod [readiness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#readiness-probe)|
@@ -215,6 +217,7 @@ API's you need to install the prometheus operator in your cluster.
215217
| --------------------------------- | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
216218
| `worker.*` | dict | | NFD worker daemonset configuration |
217219
| `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed |
220+
| `worker.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
218221
| `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
219222
| `worker.healthPort` | int | 8082 | Port on which to expose the grpc health endpoint |
220223
| `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) |
@@ -232,6 +235,7 @@ API's you need to install the prometheus operator in your cluster.
232235
| `worker.priorityClassName` | string | | NFD worker pod [priority class](https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/) |
233236
| `worker.annotations` | dict | {} | NFD worker pod [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
234237
| `worker.daemonsetAnnotations` | dict | {} | NFD worker daemonset [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
238+
| `worker.extraEnvs` | array | [] | Additional environment variables to pass to nfd-worker |
235239
| `worker.revisionHistoryLimit` | integer | | Specify how many old ControllerRevisions for this DaemonSet you want to retain. [revisionHistoryLimit](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec) |
236240
| `worker.livenessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":10} | NFD worker pod [liveness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#liveness-probe) |
237241
| `worker.readinessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":5,"failureThreshold": 10} | NFD worker pod [readiness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#readiness-probe)|
@@ -242,6 +246,7 @@ API's you need to install the prometheus operator in your cluster.
242246
|-----------------------------------------------|--------|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
243247
| `topologyUpdater.*` | dict | | NFD Topology Updater configuration |
244248
| `topologyUpdater.enable` | bool | false | Specifies whether the NFD Topology Updater should be created |
249+
| `topologyUpdater.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
245250
| `topologyUpdater.createCRDs` | bool | false | Specifies whether the NFD Topology Updater CRDs should be created |
246251
| `topologyUpdater.serviceAccount.create` | bool | true | Specifies whether the service account for topology updater should be created |
247252
| `topologyUpdater.serviceAccount.annotations` | dict | {} | Annotations to add to the service account for topology updater |
@@ -265,6 +270,7 @@ API's you need to install the prometheus operator in your cluster.
265270
| `topologyUpdater.config` | dict | | [configuration](../reference/topology-updater-configuration-reference) |
266271
| `topologyUpdater.podSetFingerprint` | bool | true | Enables compute and report of pod fingerprint in NRT objects. |
267272
| `topologyUpdater.kubeletStateDir` | string | /var/lib/kubelet | Specifies kubelet state directory path for watching state and checkpoint files. Empty value disables kubelet state tracking. |
273+
| `topologyUpdater.extraEnvs` | array | [] | Additional environment variables to pass to nfd-topology-updater |
268274
| `topologyUpdater.revisionHistoryLimit` | integer | | Specify how many old ControllerRevisions for this DaemonSet you want to retain. [revisionHistoryLimit](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec) |
269275
| `topologyUpdater.livenessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":10} | Topology updater pod [liveness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#liveness-probe) |
270276
| `topologyUpdater.readinessProbe` | dict | {"grpc":{"port":8082},"initialDelaySeconds":5,"failureThreshold": 10} | Topology updater pod [readiness probe](https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/#readiness-probe)|
@@ -275,6 +281,7 @@ API's you need to install the prometheus operator in your cluster.
275281
|---------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------|
276282
| `gc.*` | dict | | NFD Garbage Collector configuration |
277283
| `gc.enable` | bool | true | Specifies whether the NFD Garbage Collector should be created |
284+
| `gc.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
278285
| `gc.serviceAccount.create` | bool | true | Specifies whether the service account for garbage collector should be created |
279286
| `gc.serviceAccount.annotations` | dict | {} | Annotations to add to the service account for garbage collector |
280287
| `gc.serviceAccount.name` | string | | The name of the service account for garbage collector to use. If not set and create is true, a name is generated using the fullname template and `-gc` suffix |
@@ -289,6 +296,7 @@ API's you need to install the prometheus operator in your cluster.
289296
| `gc.annotations` | dict | {} | Garbage collector pod [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
290297
| `gc.deploymentAnnotations` | dict | {} | Garbage collector deployment [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
291298
| `gc.affinity` | dict | {} | Garbage collector pod [affinity](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) |
299+
| `gc.extraEnvs` | array | [] | Additional environment variables to pass to nfd-gc |
292300
| `gc.revisionHistoryLimit` | integer | | Specify how many old ReplicaSets for this Deployment you want to retain. [revisionHistoryLimit](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#revision-history-limit) |
293301

294302
<!-- Links -->

0 commit comments

Comments
 (0)