Skip to content

Commit

Permalink
Add NodeFeatureGroup API
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
  • Loading branch information
ArangoGutierrez committed Dec 1, 2023
1 parent bdfef6d commit 15fc860
Show file tree
Hide file tree
Showing 45 changed files with 5,724 additions and 104 deletions.
2 changes: 2 additions & 0 deletions cmd/nfd-master/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ func initFlags(flagset *flag.FlagSet) (*master.Args, *master.ConfigOverrideArgs)
flagset.BoolVar(&args.EnableNodeFeatureApi, "enable-nodefeature-api", true,
"Enable the NodeFeature CRD API for receiving node features. This will automatically disable the gRPC communication."+
" DEPRECATED: will be removed in a future release along with the deprecated gRPC API.")
flagset.BoolVar(&args.EnableNodeFeatureGroupApi, "enable-nodefeaturegroup-api", true,
"Enable the NodeFeatureGroup CRD API for receiving cluster feature rules.")
flagset.BoolVar(&args.CrdController, "featurerules-controller", true,
"Enable NFD CRD API controller. DEPRECATED: use -crd-controller instead")
flagset.BoolVar(&args.CrdController, "crd-controller", true,
Expand Down
321 changes: 321 additions & 0 deletions deployment/base/nfd-crds/nfd-api-crds.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions deployment/base/rbac/master-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ rules:
- get
- list
- watch
- apiGroups:
- nfd.k8s-sigs.io
resources:
- nodefeaturegroups
- nodefeaturegrouprules
verbs:
- get
- list
- watch
- update
- create
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
321 changes: 321 additions & 0 deletions deployment/helm/node-feature-discovery/crds/nfd-api-crds.yaml

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions deployment/helm/node-feature-discovery/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ rules:
- get
- list
- watch
- apiGroups:
- nfd.k8s-sigs.io
resources:
- nodefeaturegroups
- nodefeaturegrouprules
verbs:
- get
- list
- watch
- update
- create
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
3 changes: 3 additions & 0 deletions deployment/helm/node-feature-discovery/templates/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ spec:
{{- if .Values.master.instance | empty | not }}
- "-instance={{ .Values.master.instance }}"
{{- end }}
{{- if not .Values.enableNodeFeatureGroup }}
- "-enable-nodefeature-group=false"
{{- end }}
{{- if not .Values.enableNodeFeatureApi }}
- "-port={{ .Values.master.port | default "8080" }}"
- "-enable-nodefeature-api=false"
Expand Down
1 change: 1 addition & 0 deletions deployment/helm/node-feature-discovery/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fullnameOverride: ""
namespaceOverride: ""

enableNodeFeatureApi: true
enableNodeFeatureGroup: true

master:
enable: true
Expand Down
14 changes: 14 additions & 0 deletions docs/reference/master-commandline-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ Example:
nfd-master -enable-nodefeature-api=false
```

### -enable-nodefeaturegroup-api

The `-enable-nodefeaturegroup-api` flag enables/disables the
[NodeFeatureGroup](../usage/custom-resources.md#nodefeaturegroup) CRD API for
working with NodeFeatureGroups.

Default: true

Example:

```bash
nfd-master -enable-nodefeaturegroup-api=false
```

### -enable-leader-election

The `-enable-leader-election` flag enables leader election for NFD-Master.
Expand Down
48 changes: 48 additions & 0 deletions docs/usage/custom-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,54 @@ See the
[Customization guide](customization-guide.md#node-feature-rule-custom-resource)
for full documentation of the NodeFeatureRule resource and its usage.
## NodeFeatureGroup
NodeFeatureGroup is an NFD-specific custom resource that is designed for
grouping Nodes by matching features rules. NFD-Master watches for
NodeFeatureGroupRules objects in the cluster and creates a NodeFeatureGroup
object for each NodeFeatureGroupRule. The NodeFeatureGroup object contains a
list of nodes that match the NodeFeatureGroupRule.
```yaml
apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureGroup
metadata:
name: my-sample-group-resource
namespace: node-feature-discovery
spec:
FeatureGroup:
name: my-sample-group-resource
nodes:
- node-1
- node-2
- node-3
```
## NodeFeatureGroupRule
NodeFeatureGroupRule is an NFD-specific custom resource that is designed for
grouping Nodes by matching features rules. NFD-Master watches for
NodeFeatureGroupRules objects in the cluster and creates a NodeFeatureGroup
object for each NodeFeatureGroupRule.
NodeFeatureGroupRule is similar to NodeFeatureRule, but instead of labeling
nodes, it creates a NodeFeatureGroup object that contains a list of nodes that
match the NodeFeatureGroupRule.
```yaml
apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureGroupRule
metadata:
name: my-sample-group-resource
spec:
featureGroupRules:
- name: dummy-rule
matchFeatures:
- feature: kernel.version
matchExpressions:
major: {op: Exists}
```
## NodeResourceTopology
When run with NFD-Topology-Updater, NFD creates NodeResourceTopology objects
Expand Down
12 changes: 12 additions & 0 deletions examples/nodefeaturerule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ spec:
- feature: kernel.version
matchExpressions:
major: {op: Exists}
---
apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureGroupRule
metadata:
name: my-sample-group-resource
spec:
featureGroupRules:
- name: dummy-rule
matchFeatures:
- feature: kernel.version
matchExpressions:
major: {op: Exists}
Loading

0 comments on commit 15fc860

Please sign in to comment.