1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-06 16:57:10 +00:00
node-feature-discovery/deployment/base/nfd-crds/cr-sample.yaml
Markus Lehtonen 999628418b source/storage: implement FeatureSource
Separate feature discovery and creation of feature labels. Generalize
the feature discovery so that block devices can be matched in custom
label rules in a similar fashion as pci and usb devices. This extends
the discovery to other block queue attributes than 'rotational': now we
also detect 'dax', 'nr_zones' and 'zoned'.

Labels created by the storage feature source are unchanged. The new
features being detected are available in custom rules only.

Example custom rules:

  - name: "my block rule 1"
    labels:
      my-block-feature-1: "true"
    matchFeatures:
      - feature: storage.block
          "rotational": {op: In, value: ["0"]}

  - name: "my block rule 2"
    labels:
      my-block-feature-2: "true"
    matchFeatures:
      - feature: storage.block
          "zoned": {op: In, value: [“host-aware”, “host-managed”]}

Also, add minimalist unit test.
2021-11-18 14:58:33 +02:00

76 lines
2.4 KiB
YAML

apiVersion: nfd.k8s-sigs.io/v1alpha1
kind: NodeFeatureRule
metadata:
name: my-rule
spec:
rules:
# The following feature demonstrates the capabilities of the matchFeatures and
# matchAny matchers.
- name: "my feature rule"
labels:
"my-complex-feature": "my-value"
# matchFeatures implements a logical AND over feature matchers.
matchFeatures:
- feature: cpu.cpuid
matchExpressions:
AVX512F: {op: Exists}
- feature: cpu.cstate
matchExpressions:
enabled: {op: IsTrue}
- feature: cpu.pstate
matchExpressions:
no_turbo: {op: IsFalse}
scaling_governor: {op: In, value: ["performance"]}
- feature: cpu.rdt
matchExpressions:
RDTL3CA: {op: Exists}
- feature: cpu.sst
matchExpressions:
bf.enabled: {op: IsTrue}
- feature: cpu.topology
matchExpressions:
hardware_multithreading: {op: IsFalse}
- feature: kernel.config
matchExpressions:
X86: {op: Exists}
LSM: {op: InRegexp, value: ["apparmor"]}
- feature: kernel.loadedmodule
matchExpressions:
e1000e: {op: Exists}
- feature: kernel.selinux
matchExpressions:
enabled: {op: IsFalse}
- feature: kernel.version
matchExpressions:
major: {op: In, value: ["5"]}
minor: {op: Gt, value: ["10"]}
- feature: storage.block
matchExpressions:
rotational: {op: In, value: ["0"]}
dax: {op: In, value: ["0"]}
- feature: system.osrelease
matchExpressions:
ID: {op: In, value: ["fedora", "centos"]}
- feature: system.name
matchExpressions:
nodename: {op: InRegexp, value: ["^worker-X"]}
- feature: local.label
matchExpressions:
custom-feature-knob: {op: Gt, value: ["100"]}
# matchAny implements a logical IF over all listed matchers (i.e. at
# least one must match)
matchAny:
- matchFeatures:
- feature: pci.device
matchExpressions:
vendor: {op: In, value: ["8086"]}
class: {op: In, value: ["0200"]}
- feature: usb.device
matchExpressions:
vendor: {op: In, value: ["8086"]}
class: {op: In, value: ["02"]}