Skip to content

Commit 76569bd

Browse files
committed
api/nfd: extend NodeFeatureGroup to support vars
Add Vars and VarsTemplate fields to the NodeFeatureGroup spec. This enables construction of complex rule hierarchies by making it possible to reference/use results of preceding rules when evaluating a rule.
1 parent b843a3f commit 76569bd

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

api/nfd/v1alpha1/types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ type GroupRule struct {
183183
// Name of the rule.
184184
Name string `json:"name"`
185185

186+
// Vars is the variables to store if the rule matches. Variables can be
187+
// referenced from other rules enabling more complex rule hierarchies.
188+
// +optional
189+
Vars map[string]string `json:"vars"`
190+
191+
// VarsTemplate specifies a template to expand for dynamically generating
192+
// multiple variables. Data (after template expansion) must be keys with an
193+
// optional value (<key>[=<value>]) separated by newlines.
194+
// +optional
195+
VarsTemplate string `json:"varsTemplate"`
196+
186197
// MatchFeatures specifies a set of matcher terms all of which must match.
187198
// +optional
188199
MatchFeatures FeatureMatcher `json:"matchFeatures"`

api/nfd/v1alpha1/zz_generated.deepcopy.go

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

deployment/base/nfd-crds/nfd-api-crds.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,19 @@ spec:
356356
name:
357357
description: Name of the rule.
358358
type: string
359+
vars:
360+
additionalProperties:
361+
type: string
362+
description: |-
363+
Vars is the variables to store if the rule matches. Variables can be
364+
referenced from other rules enabling more complex rule hierarchies.
365+
type: object
366+
varsTemplate:
367+
description: |-
368+
VarsTemplate specifies a template to expand for dynamically generating
369+
multiple variables. Data (after template expansion) must be keys with an
370+
optional value (<key>[=<value>]) separated by newlines.
371+
type: string
359372
required:
360373
- name
361374
type: object

deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,19 @@ spec:
356356
name:
357357
description: Name of the rule.
358358
type: string
359+
vars:
360+
additionalProperties:
361+
type: string
362+
description: |-
363+
Vars is the variables to store if the rule matches. Variables can be
364+
referenced from other rules enabling more complex rule hierarchies.
365+
type: object
366+
varsTemplate:
367+
description: |-
368+
VarsTemplate specifies a template to expand for dynamically generating
369+
multiple variables. Data (after template expansion) must be keys with an
370+
optional value (<key>[=<value>]) separated by newlines.
371+
type: string
359372
required:
360373
- name
361374
type: object

0 commit comments

Comments
 (0)