-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sample NodeFeatureRules for all built-in labels
This patch adds sample NodeFeatureRules that correspond the built-in labels created by nfd-worker (with its default configuration). The samples provide examples on how to utilize NodeFeatureRules and an easy way to modify the labels being generated. In order to replace the built-in node labeling of nfd-worker with these sample rules, all node labeling from nfd-worker must be disabled by setting the "core.labelSources" configuration option to an empty list (or specify "-label-sources= " on the command line). Then, with all nfd-worker side labeling disabled, just apply the rules with kubectl apply -f samples/
- Loading branch information
Showing
10 changed files
with
350 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in cpu feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-cpu-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in cpu-cpuid labels" | ||
labelsTemplate: | | ||
{{ range .cpu.cpuid }}cpu-cpuid.{{ .Name }}=true | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.cpuid | ||
matchName: | ||
op: NotIn | ||
value: | ||
- "BMI1" | ||
- "BMI2" | ||
- "CLMUL" | ||
- "CMOV" | ||
- "CX16" | ||
- "ERMS" | ||
- "F16C" | ||
- "HTT" | ||
- "LZCNT" | ||
- "MMX" | ||
- "MMXEXT" | ||
- "NX" | ||
- "POPCNT" | ||
- "RDRAND" | ||
- "RDSEED" | ||
- "RDTSCP" | ||
- "SGX" | ||
- "SGXLC" | ||
- "SSE" | ||
- "SSE2" | ||
- "SSE3" | ||
- "SSE4" | ||
- "SSE42" | ||
- "SSSE3" | ||
|
||
- name: "nfd built-in cpu-hardware_multithreading label" | ||
labelsTemplate: | | ||
{{ range .cpu.topology }}cpu-{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.topology | ||
matchName: | ||
op: In | ||
value: | ||
- "hardware_multithreading" | ||
|
||
- name: "nfd built-in cpu-cstate and cpu-pstate labels" | ||
labelsTemplate: | | ||
{{ range .cpu.cstate }}cpu-cstate.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
{{ range .cpu.pstate }}cpu-pstate.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchAny: | ||
- matchFeatures: | ||
- feature: cpu.cstate | ||
matchName: | ||
op: Exists | ||
- matchFeatures: | ||
- feature: cpu.pstate | ||
matchName: | ||
op: Exists | ||
|
||
- name: "nfd built-in cpu-model labels" | ||
labelsTemplate: | | ||
{{ range .cpu.model }}cpu-model.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.model | ||
matchName: | ||
op: Exists | ||
|
||
- name: "nfd built-in cpu-security labels" | ||
labelsTemplate: | | ||
{{ range .cpu.security }}cpu-security.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.security | ||
matchName: | ||
op: NotIn | ||
value: | ||
- "tdx.total_keys" | ||
- "sgx.epc" | ||
- "sev.encrypted_state_ids" | ||
- "sev.asids" | ||
|
||
- name: "nfd built-in cpu-sst labels" | ||
labelsTemplate: | | ||
{{ range .cpu.sst }}cpu-power.sst_{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.sst | ||
matchName: | ||
op: Exists | ||
|
||
- name: "nfd built-in cpu-coprocessor labels" | ||
labelsTemplate: | | ||
{{ range .cpu.sst }}cpu-coprocessor.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: cpu.coprocessor | ||
matchName: | ||
op: In | ||
value: | ||
- "nx_gzip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in static custom feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-custom-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in static custom rdma.capable label" | ||
labels: | ||
"custom-rdma.capable": "true" | ||
matchFeatures: | ||
- feature: pci.device | ||
matchExpressions: | ||
vendor: | ||
op: In | ||
value: ["15b3"] | ||
|
||
- name: "nfd built-in static custom rdma.available label" | ||
labels: | ||
"custom-rdma.available": "true" | ||
matchFeatures: | ||
- feature: kernel.loadedmodule | ||
matchExpressions: | ||
"ib_uverbs": | ||
op: Exists | ||
"rdma_ucm": | ||
op: Exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in kernel feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-kernel-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in kernel-version labels" | ||
labelsTemplate: | | ||
{{ range .kernel.version }}kernel-version.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: kernel.version | ||
matchName: | ||
op: Exists | ||
|
||
- name: "nfd built-in kernel-config labels" | ||
labelsTemplate: | | ||
{{ range .kernel.config }}kernel-config.{{ .Name }}=true | ||
{{ end }} | ||
matchFeatures: | ||
- feature: kernel.config | ||
matchExpressions: | ||
"NO_HZ": {op: In, value: ["y"]} | ||
"NO_HZ_IDLE": {op: In, value: ["y"]} | ||
"NO_HZ_FULL": {op: In, value: ["y"]} | ||
"PREEMPT": {op: In, value: ["y"]} | ||
|
||
- name: "nfd built-in kernel-selinux labels" | ||
labels: | ||
"kernel-selinux.enabled": "true" | ||
matchFeatures: | ||
- feature: kernel.selinux | ||
matchExpressions: | ||
"enabled": | ||
op: IsTrue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in local feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-local-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in labels from the local feature source" | ||
labelsTemplate: | | ||
{{ range .local.label }}{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: local.label | ||
matchName: | ||
op: Exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in memory feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-memory-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in memory-numa labels" | ||
labels: | ||
"memory-numa": "true" | ||
matchFeatures: | ||
- feature: memory.numa | ||
matchExpressions: | ||
"is_numa": | ||
op: IsTrue | ||
|
||
- name: "nfd built-in memory-nv.present label" | ||
labelsTemplate: "{{ if gt (len .memory.nv ) 0 }}memory-nv.present=true{{ end }}" | ||
matchFeatures: | ||
- feature: memory.nv | ||
matchName: | ||
op: Exists | ||
|
||
- name: "nfd built-in memory-nv.dax label" | ||
labels: | ||
"memory.nv.dax": "true" | ||
matchFeatures: | ||
- feature: memory.nv | ||
matchExpressions: | ||
"devtype": | ||
op: In | ||
value: ["nd_dax"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in networkfeature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-network-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in network-sriov.capable label" | ||
labels: | ||
"network-sriov.capable": "true" | ||
matchFeatures: | ||
- feature: network.device | ||
matchExpressions: | ||
"sriov_totalvfs": | ||
op: Gt | ||
value: ["0"] | ||
|
||
- name: "nfd built-in network-sriov.configured label" | ||
labels: | ||
"network-sriov.configured": "true" | ||
matchFeatures: | ||
- feature: network.device | ||
matchExpressions: | ||
"network-sriov_numvfs": | ||
op: Gt | ||
value: ["0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in pci feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-pci-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in pci-<device>.present labels" | ||
labelsTemplate: | | ||
{{ range .pci.device }}pci-{{ .class }}_{{ .vendor }}.present=true | ||
{{ end }} | ||
matchFeatures: | ||
- feature: pci.device | ||
matchExpressions: | ||
"class": | ||
op: InRegexp | ||
value: ["^03", "^0b40", "^12"] | ||
|
||
- name: "nfd built-in pci-<device>.sriov.capable labels" | ||
labelsTemplate: | | ||
{{ range .pci.device }}pci-{{ .class }}_{{ .vendor }}.sriov.capable=true | ||
{{ end }} | ||
matchFeatures: | ||
- feature: pci.device | ||
matchExpressions: | ||
"class": | ||
op: InRegexp | ||
value: ["^03", "^0b40", "^12"] | ||
"sriov_totalvfs": | ||
op: Exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in storage feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-storage-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in storage-nonrotationaldisk label" | ||
labels: | ||
"storage-nonrotationaldisk": "true" | ||
matchFeatures: | ||
- feature: storage.block | ||
matchExpressions: | ||
"rotational": | ||
op: In | ||
value: ["0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in system feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-system-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in system-os_release labels" | ||
labelsTemplate: | | ||
{{ range .system.osrelease }}system-os_release.{{ .Name }}={{ .Value }} | ||
{{ end }} | ||
matchFeatures: | ||
- feature: system.osrelease | ||
matchName: | ||
op: In | ||
value: | ||
- "ID" | ||
- "VERSION_ID" | ||
- "VERSION_ID.major" | ||
- "VERSION_ID.minor" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# This NodeFeatureRule replicates all built-in usb feature labels of NFD. | ||
# | ||
apiVersion: nfd.k8s-sigs.io/v1alpha1 | ||
kind: NodeFeatureRule | ||
metadata: | ||
name: nfd-builtin-usb-features | ||
spec: | ||
rules: | ||
- name: "nfd built-in usb-<device>.present labels" | ||
labelsTemplate: | | ||
{{ range .usb.device }}usb-{{ .class }}_{{ .vendor }}_{{ .device }}.present=true | ||
{{ end }} | ||
matchFeatures: | ||
- feature: usb.device | ||
matchExpressions: | ||
"class": | ||
op: In | ||
value: ["0e", "ef", "fe", "ff"] |