Skip to content

Commit 2d89e71

Browse files
Add NodeFeatureGroup API
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent bdfef6d commit 2d89e71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5730
-104
lines changed

cmd/nfd-master/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
133133
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
134134
"Enable the NodeFeature CRD API for receiving node features. This will automatically disable the gRPC communication."+
135135
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
136+
flagset.BoolVar(&args.EnableNodeFeatureGroupApi, "enable-nodefeaturegroup-api", false,
137+
"Enable the NodeFeatureGroup CRD API for receiving cluster feature rules.")
136138
flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
137139
"Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead")
138140
flagset.BoolVar(&args.CrdController, "crd-controller", true,

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

+321
Large diffs are not rendered by default.

deployment/base/rbac/master-clusterrole.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ rules:
2222
- get
2323
- list
2424
- watch
25+
- apiGroups:
26+
- nfd.k8s-sigs.io
27+
resources:
28+
- nodefeaturegroups
29+
- nodefeaturegrouprules
30+
verbs:
31+
- get
32+
- list
33+
- watch
34+
- update
35+
- create
2536
- apiGroups:
2637
- coordination.k8s.io
2738
resources:

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

+321
Large diffs are not rendered by default.

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

+11
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ rules:
2525
- get
2626
- list
2727
- watch
28+
- apiGroups:
29+
- nfd.k8s-sigs.io
30+
resources:
31+
- nodefeaturegroups
32+
- nodefeaturegrouprules
33+
verbs:
34+
- get
35+
- list
36+
- watch
37+
- update
38+
- create
2839
- apiGroups:
2940
- coordination.k8s.io
3041
resources:

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

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ spec:
7070
{{- if .Values.master.instance | empty | not }}
7171
- "-instance={{ .Values.master.instance }}"
7272
{{- end }}
73+
{{- if .Values.enableNodeFeatureGroup }}
74+
- "-enable-nodefeaturegroup-api=true"
75+
{{- end }}
7376
{{- if not .Values.enableNodeFeatureApi }}
7477
- "-port={{ .Values.master.port | default "8080" }}"
7578
- "-enable-nodefeature-api=false"

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

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fullnameOverride: ""
1111
namespaceOverride: ""
1212

1313
enableNodeFeatureApi: true
14+
enableNodeFeatureGroupApi: false
1415

1516
master:
1617
enable: true

docs/reference/master-commandline-reference.md

+16
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,22 @@ Example:
181181
nfd-master -enable-nodefeature-api=false
182182
```
183183

184+
### -enable-nodefeaturegroup-api
185+
186+
> **NOTE:** This feature is experimental and may change in the future.
187+
188+
The `-enable-nodefeaturegroup-api` flag enables/disables the
189+
[NodeFeatureGroup](../usage/custom-resources.md#nodefeaturegroup) CRD API for
190+
working with NodeFeatureGroups.
191+
192+
Default: false
193+
194+
Example:
195+
196+
```bash
197+
nfd-master -enable-nodefeaturegroup-api=false
198+
```
199+
184200
### -enable-leader-election
185201

186202
The `-enable-leader-election` flag enables leader election for NFD-Master.

docs/usage/custom-resources.md

+52
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,58 @@ See the
8686
[Customization guide](customization-guide.md#node-feature-rule-custom-resource)
8787
for full documentation of the NodeFeatureRule resource and its usage.
8888
89+
## NodeFeatureGroup
90+
91+
> **NOTE:** This feature is experimental and may change in the future.
92+
93+
NodeFeatureGroup is an NFD-specific custom resource that is designed for
94+
grouping Nodes by matching features rules. NFD-Master watches for
95+
NodeFeatureGroupRules objects in the cluster and creates a NodeFeatureGroup
96+
object for each NodeFeatureGroupRule. The NodeFeatureGroup object contains a
97+
list of nodes that match the NodeFeatureGroupRule.
98+
99+
```yaml
100+
apiVersion: nfd.k8s-sigs.io/v1alpha1
101+
kind: NodeFeatureGroup
102+
metadata:
103+
name: my-sample-group-resource
104+
namespace: node-feature-discovery
105+
spec:
106+
FeatureGroup:
107+
name: my-sample-group-resource
108+
nodes:
109+
- node-1
110+
- node-2
111+
- node-3
112+
```
113+
114+
## NodeFeatureGroupRule
115+
116+
> **NOTE:** This feature is experimental and may change in the future.
117+
118+
NodeFeatureGroupRule is an NFD-specific custom resource that is designed for
119+
grouping Nodes by matching features rules. NFD-Master watches for
120+
NodeFeatureGroupRules objects in the cluster and creates a NodeFeatureGroup
121+
object for each NodeFeatureGroupRule.
122+
123+
NodeFeatureGroupRule is similar to NodeFeatureRule, but instead of labeling
124+
nodes, it creates a NodeFeatureGroup object that contains a list of nodes that
125+
match the NodeFeatureGroupRule.
126+
127+
```yaml
128+
apiVersion: nfd.k8s-sigs.io/v1alpha1
129+
kind: NodeFeatureGroupRule
130+
metadata:
131+
name: my-sample-group-resource
132+
spec:
133+
featureGroupRules:
134+
- name: dummy-rule
135+
matchFeatures:
136+
- feature: kernel.version
137+
matchExpressions:
138+
major: {op: Exists}
139+
```
140+
89141
## NodeResourceTopology
90142
91143
When run with NFD-Topology-Updater, NFD creates NodeResourceTopology objects

examples/nodefeaturerule.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@ spec:
2929
- feature: kernel.version
3030
matchExpressions:
3131
major: {op: Exists}
32+
---
33+
apiVersion: nfd.k8s-sigs.io/v1alpha1
34+
kind: NodeFeatureGroupRule
35+
metadata:
36+
name: my-sample-group-resource
37+
spec:
38+
featureGroupRules:
39+
- name: dummy-rule
40+
matchFeatures:
41+
- feature: kernel.version
42+
matchExpressions:
43+
major: {op: Exists}

0 commit comments

Comments
 (0)