Skip to content

Commit a5222c6

Browse files
authored
Merge pull request #68979 from sheriff-rh/OCPBUGS-13794
2 parents 3af70c0 + 2a2bd7a commit a5222c6

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

hardware_enablement/psap-node-feature-discovery-operator.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ include::modules/psap-using-node-feature-discovery-operator.adoc[leveloffset=+1]
1616

1717
include::modules/psap-configuring-node-feature-discovery.adoc[leveloffset=+1]
1818

19+
include::modules/nfd-rules-about.adoc[leveloffset=+1]
20+
21+
include::modules/nfd-rules-using.adoc[leveloffset=+1]
22+
1923
include::modules/psap-node-feature-discovery-using-topology-updater.adoc[leveloffset=+1]
2024

2125
include::modules/psap-node-feature-discovery-topology-updater-command-reference.adoc[leveloffset=+2]

modules/nfd-rules-about.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * hardware_enablement/psap-node-feature-discovery-operator.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="nfd-rules-about_{context}"]
7+
= About the NodeFeatureRule custom resource
8+
9+
`NodeFeatureRule` objects are a `NodeFeatureDiscovery` custom resource designed for rule-based custom labeling of nodes. Some use cases include application-specific labeling or distribution by hardware vendors to create specific labels for their devices.
10+
11+
`NodeFeatureRule` objects provide a method to create vendor- or application-specific labels and taints. It uses a flexible rule-based mechanism for creating labels and optionally taints based on node features.

modules/nfd-rules-using.adoc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * hardware_enablement/psap-node-feature-discovery-operator.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="nfd-rules-using_{context}"]
7+
= Using the NodeFeatureRule custom resource
8+
9+
Create a `NodeFeatureRule` object to label nodes if a set of rules match the conditions.
10+
11+
.Procedure
12+
13+
. Create a custom resource file named `nodefeaturerule.yaml` that contains the following text:
14+
+
15+
[source,yaml]
16+
----
17+
apiVersion: nfd.openshift.io/v1
18+
kind: NodeFeatureRule
19+
metadata:
20+
name: example-rule
21+
spec:
22+
rules:
23+
- name: "example rule"
24+
labels:
25+
"example-custom-feature": "true"
26+
# Label is created if all of the rules below match
27+
matchFeatures:
28+
# Match if "veth" kernel module is loaded
29+
- feature: kernel.loadedmodule
30+
matchExpressions:
31+
veth: {op: Exists}
32+
# Match if any PCI device with vendor 8086 exists in the system
33+
- feature: pci.device
34+
matchExpressions:
35+
vendor: {op: In, value: ["8086"]}
36+
----
37+
+
38+
This custom resource specifies that labelling occurs when the `veth` module is loaded and any PCI device with vendor code `8086` exists in the cluster.
39+
40+
. Apply the `nodefeaturerule.yaml` file to your cluster by running the following command:
41+
+
42+
[source,terminal]
43+
----
44+
$ oc apply -f https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/v0.13.6/examples/nodefeaturerule.yaml
45+
----
46+
The example applies the feature label on nodes with the `veth` module loaded and any PCI device with vendor code `8086` exists.
47+
+
48+
[NOTE]
49+
====
50+
A relabeling delay of up to 1 minute might occur.
51+
====

0 commit comments

Comments
 (0)