Skip to content

Commit 720447f

Browse files
Adding WorkerEnvs and MasterEnv fields to the NFD CR
Those fields will allow adding additional environment variables to the master deployment and worker daemonset, which will allow operator deployment to support addional NFD deployments scenarios, like using KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORt
1 parent 7aa00b9 commit 720447f

File tree

3 files changed

+242
-0
lines changed

3 files changed

+242
-0
lines changed

api/v1/nodefeaturediscovery_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ type OperandSpec struct {
101101

102102
// MasterTolerations defines tolerations to be applied to the master deployment
103103
MasterTolerations []corev1.Toleration `json:"masterTolerations,omitempty"`
104+
105+
// WorkerEnv defines environment variables to be added to the worker Daemonset
106+
WorkerEnvs []corev1.EnvVar `json:"workerEnvs,omitempty"`
107+
108+
// MasterEnv defines environment variables to be added to the master deployment
109+
MasterEnvs []corev1.EnvVar `json:"masterEnvs,omitempty"`
104110
}
105111

106112
// ConfigMap describes configuration options for the NFD worker

api/v1/zz_generated.deepcopy.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/nfd.kubernetes.io_nodefeaturediscoveries.yaml

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,117 @@ spec:
7272
description: ImagePullPolicy defines Image pull policy for the
7373
NFD operand image [defaults to Always]
7474
type: string
75+
masterEnvs:
76+
description: MasterEnv defines environment variables to be added
77+
to the master deployment
78+
items:
79+
description: EnvVar represents an environment variable present
80+
in a Container.
81+
properties:
82+
name:
83+
description: Name of the environment variable. Must be a
84+
C_IDENTIFIER.
85+
type: string
86+
value:
87+
description: 'Variable references $(VAR_NAME) are expanded
88+
using the previously defined environment variables in
89+
the container and any service environment variables. If
90+
a variable cannot be resolved, the reference in the input
91+
string will be unchanged. Double $$ are reduced to a single
92+
$, which allows for escaping the $(VAR_NAME) syntax: i.e.
93+
"$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)".
94+
Escaped references will never be expanded, regardless
95+
of whether the variable exists or not. Defaults to "".'
96+
type: string
97+
valueFrom:
98+
description: Source for the environment variable's value.
99+
Cannot be used if value is not empty.
100+
properties:
101+
configMapKeyRef:
102+
description: Selects a key of a ConfigMap.
103+
properties:
104+
key:
105+
description: The key to select.
106+
type: string
107+
name:
108+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
109+
TODO: Add other useful fields. apiVersion, kind,
110+
uid?'
111+
type: string
112+
optional:
113+
description: Specify whether the ConfigMap or its
114+
key must be defined
115+
type: boolean
116+
required:
117+
- key
118+
type: object
119+
fieldRef:
120+
description: 'Selects a field of the pod: supports metadata.name,
121+
metadata.namespace, `metadata.labels[''<KEY>'']`,
122+
`metadata.annotations[''<KEY>'']`, spec.nodeName,
123+
spec.serviceAccountName, status.hostIP, status.podIP,
124+
status.podIPs.'
125+
properties:
126+
apiVersion:
127+
description: Version of the schema the FieldPath
128+
is written in terms of, defaults to "v1".
129+
type: string
130+
fieldPath:
131+
description: Path of the field to select in the
132+
specified API version.
133+
type: string
134+
required:
135+
- fieldPath
136+
type: object
137+
resourceFieldRef:
138+
description: 'Selects a resource of the container: only
139+
resources limits and requests (limits.cpu, limits.memory,
140+
limits.ephemeral-storage, requests.cpu, requests.memory
141+
and requests.ephemeral-storage) are currently supported.'
142+
properties:
143+
containerName:
144+
description: 'Container name: required for volumes,
145+
optional for env vars'
146+
type: string
147+
divisor:
148+
anyOf:
149+
- type: integer
150+
- type: string
151+
description: Specifies the output format of the
152+
exposed resources, defaults to "1"
153+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
154+
x-kubernetes-int-or-string: true
155+
resource:
156+
description: 'Required: resource to select'
157+
type: string
158+
required:
159+
- resource
160+
type: object
161+
secretKeyRef:
162+
description: Selects a key of a secret in the pod's
163+
namespace
164+
properties:
165+
key:
166+
description: The key of the secret to select from. Must
167+
be a valid secret key.
168+
type: string
169+
name:
170+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
171+
TODO: Add other useful fields. apiVersion, kind,
172+
uid?'
173+
type: string
174+
optional:
175+
description: Specify whether the Secret or its key
176+
must be defined
177+
type: boolean
178+
required:
179+
- key
180+
type: object
181+
type: object
182+
required:
183+
- name
184+
type: object
185+
type: array
75186
masterTolerations:
76187
description: MasterTolerations defines tolerations to be applied
77188
to the master deployment
@@ -118,6 +229,117 @@ spec:
118229
description: ServicePort specifies the TCP port that nfd-master
119230
listens for incoming requests.
120231
type: integer
232+
workerEnvs:
233+
description: WorkerEnv defines environment variables to be added
234+
to the worker Daemonset
235+
items:
236+
description: EnvVar represents an environment variable present
237+
in a Container.
238+
properties:
239+
name:
240+
description: Name of the environment variable. Must be a
241+
C_IDENTIFIER.
242+
type: string
243+
value:
244+
description: 'Variable references $(VAR_NAME) are expanded
245+
using the previously defined environment variables in
246+
the container and any service environment variables. If
247+
a variable cannot be resolved, the reference in the input
248+
string will be unchanged. Double $$ are reduced to a single
249+
$, which allows for escaping the $(VAR_NAME) syntax: i.e.
250+
"$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)".
251+
Escaped references will never be expanded, regardless
252+
of whether the variable exists or not. Defaults to "".'
253+
type: string
254+
valueFrom:
255+
description: Source for the environment variable's value.
256+
Cannot be used if value is not empty.
257+
properties:
258+
configMapKeyRef:
259+
description: Selects a key of a ConfigMap.
260+
properties:
261+
key:
262+
description: The key to select.
263+
type: string
264+
name:
265+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
266+
TODO: Add other useful fields. apiVersion, kind,
267+
uid?'
268+
type: string
269+
optional:
270+
description: Specify whether the ConfigMap or its
271+
key must be defined
272+
type: boolean
273+
required:
274+
- key
275+
type: object
276+
fieldRef:
277+
description: 'Selects a field of the pod: supports metadata.name,
278+
metadata.namespace, `metadata.labels[''<KEY>'']`,
279+
`metadata.annotations[''<KEY>'']`, spec.nodeName,
280+
spec.serviceAccountName, status.hostIP, status.podIP,
281+
status.podIPs.'
282+
properties:
283+
apiVersion:
284+
description: Version of the schema the FieldPath
285+
is written in terms of, defaults to "v1".
286+
type: string
287+
fieldPath:
288+
description: Path of the field to select in the
289+
specified API version.
290+
type: string
291+
required:
292+
- fieldPath
293+
type: object
294+
resourceFieldRef:
295+
description: 'Selects a resource of the container: only
296+
resources limits and requests (limits.cpu, limits.memory,
297+
limits.ephemeral-storage, requests.cpu, requests.memory
298+
and requests.ephemeral-storage) are currently supported.'
299+
properties:
300+
containerName:
301+
description: 'Container name: required for volumes,
302+
optional for env vars'
303+
type: string
304+
divisor:
305+
anyOf:
306+
- type: integer
307+
- type: string
308+
description: Specifies the output format of the
309+
exposed resources, defaults to "1"
310+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
311+
x-kubernetes-int-or-string: true
312+
resource:
313+
description: 'Required: resource to select'
314+
type: string
315+
required:
316+
- resource
317+
type: object
318+
secretKeyRef:
319+
description: Selects a key of a secret in the pod's
320+
namespace
321+
properties:
322+
key:
323+
description: The key of the secret to select from. Must
324+
be a valid secret key.
325+
type: string
326+
name:
327+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
328+
TODO: Add other useful fields. apiVersion, kind,
329+
uid?'
330+
type: string
331+
optional:
332+
description: Specify whether the Secret or its key
333+
must be defined
334+
type: boolean
335+
required:
336+
- key
337+
type: object
338+
type: object
339+
required:
340+
- name
341+
type: object
342+
type: array
121343
workerTolerations:
122344
description: WorkerTolerations defines tolerations to be applied
123345
to the worker Daemonset

0 commit comments

Comments
 (0)