Skip to content

Commit af0592b

Browse files
committed
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]>
1 parent aad1c8c commit af0592b

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ spec:
4040
enableServiceLinks: false
4141
securityContext:
4242
{{- toYaml .Values.master.podSecurityContext | nindent 8 }}
43+
hostNetwork: {{ .Values.master.hostNetwork }}
4344
containers:
4445
- name: master
4546
securityContext:
@@ -55,11 +56,16 @@ spec:
5556
name: grpc
5657
- containerPort: {{ .Values.master.metricsPort | default "8081" }}
5758
name: metrics
59+
- containerPort: 8082
60+
name: health
5861
env:
5962
- name: NODE_NAME
6063
valueFrom:
6164
fieldRef:
6265
fieldPath: spec.nodeName
66+
{{- with .Values.master.extraEnvs }}
67+
{{- toYaml . | nindent 8 }}
68+
{{- end}}
6369
command:
6470
- "nfd-master"
6571
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
@@ -39,6 +39,7 @@ spec:
3939
{{- end }}
4040
securityContext:
4141
{{- toYaml .Values.topologyUpdater.podSecurityContext | nindent 8 }}
42+
hostNetwork: {{ .Values.topologyUpdater.hostNetwork }}
4243
containers:
4344
- name: topology-updater
4445
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
@@ -56,6 +57,9 @@ spec:
5657
valueFrom:
5758
fieldRef:
5859
fieldPath: status.hostIP
60+
{{- with .Values.topologyUpdater.extraEnvs }}
61+
{{- toYaml . | nindent 8 }}
62+
{{- end}}
5963
command:
6064
- "nfd-topology-updater"
6165
args:
@@ -90,8 +94,10 @@ spec:
9094
{{- toYaml . | nindent 10 }}
9195
{{- end }}
9296
ports:
93-
- name: metrics
94-
containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}}
97+
- containerPort: {{ .Values.topologyUpdater.metricsPort | default "8081"}}
98+
name: metrics
99+
- containerPort: 8082
100+
name: health
95101
volumeMounts:
96102
{{- if .Values.topologyUpdater.kubeletConfigPath | empty | not }}
97103
- 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
@@ -39,6 +39,7 @@ spec:
3939
serviceAccountName: {{ include "node-feature-discovery.worker.serviceAccountName" . }}
4040
securityContext:
4141
{{- toYaml .Values.worker.podSecurityContext | nindent 8 }}
42+
hostNetwork: {{ .Values.worker.hostNetwork }}
4243
containers:
4344
- name: worker
4445
securityContext:
@@ -62,6 +63,9 @@ spec:
6263
valueFrom:
6364
fieldRef:
6465
fieldPath: metadata.uid
66+
{{- with .Values.worker.extraEnvs }}
67+
{{- toYaml . | nindent 8 }}
68+
{{- end}}
6569
resources:
6670
{{- toYaml .Values.worker.resources | nindent 12 }}
6771
command:
@@ -84,8 +88,10 @@ spec:
8488
{{- toYaml . | nindent 8 }}
8589
{{- end }}
8690
ports:
87-
- name: metrics
88-
containerPort: {{ .Values.worker.metricsPort | default "8081"}}
91+
- containerPort: {{ .Values.worker.metricsPort | default "8081"}}
92+
name: metrics
93+
- containerPort: 8082
94+
name: health
8995
volumeMounts:
9096
- name: host-boot
9197
mountPath: "/host-boot"

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ priorityClassName: ""
1919
master:
2020
enable: true
2121
extraArgs: []
22+
extraEnvs: []
23+
hostNetwork: false
2224
config: ### <NFD-MASTER-CONF-START-DO-NOT-REMOVE>
2325
# noPublish: false
2426
# autoDefaultNs: true
@@ -157,6 +159,8 @@ master:
157159
worker:
158160
enable: true
159161
extraArgs: []
162+
extraEnvs: []
163+
hostNetwork: false
160164
config: ### <NFD-WORKER-CONF-START-DO-NOT-REMOVE>
161165
#core:
162166
# labelWhiteList:
@@ -476,8 +480,10 @@ topologyUpdater:
476480
### <NFD-TOPOLOGY-UPDATER-CONF-END-DO-NOT-REMOVE>
477481

478482
enable: false
479-
extraArgs: []
480483
createCRDs: false
484+
extraArgs: []
485+
extraEnvs: []
486+
hostNetwork: false
481487

482488
serviceAccount:
483489
create: true
@@ -535,6 +541,8 @@ topologyUpdater:
535541
gc:
536542
enable: true
537543
extraArgs: []
544+
extraEnvs: []
545+
hostNetwork: false
538546
replicaCount: 1
539547

540548
serviceAccount:

docs/deployment/helm.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ API's you need to install the prometheus operator in your cluster.
177177
| ----------------------------------- | ------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
178178
| `master.*` | dict | | NFD master deployment configuration |
179179
| `master.enable` | bool | true | Specifies whether nfd-master should be deployed |
180+
| `master.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
180181
| `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 |
181182
| `master.metricsPort` | integer | 8081 | Port on which to expose metrics from components to prometheus operator |
182183
| `master.instance` | string | | Instance name. Used to separate annotation namespaces for multiple parallel deployments |
@@ -204,6 +205,7 @@ API's you need to install the prometheus operator in your cluster.
204205
| `master.nfdApiParallelism` | integer | 10 | Specifies the maximum number of concurrent node updates. |
205206
| `master.config` | dict | | NFD master [configuration](../reference/master-configuration-reference) |
206207
| `master.extraArgs` | array | [] | Additional [command line arguments](../reference/master-commandline-reference.md) to pass to nfd-master |
208+
| `master.extraEnvs` | array | [] | Additional environment variables to pass to nfd-master |
207209
| `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) |
208210
| `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) |
209211
| `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)|
@@ -214,6 +216,7 @@ API's you need to install the prometheus operator in your cluster.
214216
| ----------------------------------- | ------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
215217
| `worker.*` | dict | | NFD worker daemonset configuration |
216218
| `worker.enable` | bool | true | Specifies whether nfd-worker should be deployed |
219+
| `worker.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
217220
| `worker.metricsPort*` | int | 8081 | Port on which to expose metrics from components to prometheus operator |
218221
| `worker.config` | dict | | NFD worker [configuration](../reference/worker-configuration-reference) |
219222
| `worker.podSecurityContext` | dict | {} | [PodSecurityContext](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) holds pod-level security attributes and common container settins |
@@ -231,6 +234,7 @@ API's you need to install the prometheus operator in your cluster.
231234
| `worker.annotations` | dict | {} | NFD worker pod [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
232235
| `worker.daemonsetAnnotations` | dict | {} | NFD worker daemonset [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
233236
| `worker.extraArgs` | array | [] | Additional [command line arguments](../reference/worker-commandline-reference.md) to pass to nfd-worker |
237+
| `worker.extraEnvs` | array | [] | Additional environment variables to pass to nfd-worker |
234238
| `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) |
235239
| `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) |
236240
| `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)|
@@ -241,6 +245,7 @@ API's you need to install the prometheus operator in your cluster.
241245
| --------------------------------------------- | ------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
242246
| `topologyUpdater.*` | dict | | NFD Topology Updater configuration |
243247
| `topologyUpdater.enable` | bool | false | Specifies whether the NFD Topology Updater should be created |
248+
| `topologyUpdater.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
244249
| `topologyUpdater.createCRDs` | bool | false | Specifies whether the NFD Topology Updater CRDs should be created |
245250
| `topologyUpdater.serviceAccount.create` | bool | true | Specifies whether the service account for topology updater should be created |
246251
| `topologyUpdater.serviceAccount.annotations` | dict | {} | Annotations to add to the service account for topology updater |
@@ -264,6 +269,7 @@ API's you need to install the prometheus operator in your cluster.
264269
| `topologyUpdater.podSetFingerprint` | bool | true | Enables compute and report of pod fingerprint in NRT objects. |
265270
| `topologyUpdater.kubeletStateDir` | string | /var/lib/kubelet | Specifies kubelet state directory path for watching state and checkpoint files. Empty value disables kubelet state tracking. |
266271
| `topologyUpdater.extraArgs` | array | [] | Additional [command line arguments](../reference/topology-updater-commandline-reference.md) to pass to nfd-topology-updater |
272+
| `topologyUpdater.extraEnvs` | array | [] | Additional environment variables to pass to nfd-topology-updater |
267273
| `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) |
268274
| `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) |
269275
| `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)|
@@ -274,6 +280,7 @@ API's you need to install the prometheus operator in your cluster.
274280
| ------------------------------------- | ------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275281
| `gc.*` | dict | | NFD Garbage Collector configuration |
276282
| `gc.enable` | bool | true | Specifies whether the NFD Garbage Collector should be created |
283+
| `gc.hostNetwork` | bool | false | Specifies whether to enable or disable running the container in the host's network namespace |
277284
| `gc.serviceAccount.create` | bool | true | Specifies whether the service account for garbage collector should be created |
278285
| `gc.serviceAccount.annotations` | dict | {} | Annotations to add to the service account for garbage collector |
279286
| `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.deploymentAnnotations` | dict | {} | Garbage collector deployment [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) |
290297
| `gc.affinity` | dict | {} | Garbage collector pod [affinity](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/) |
291298
| `gc.extraArgs` | array | [] | Additional [command line arguments](../reference/gc-commandline-reference.md) to pass to nfd-gc |
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)