1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00
node-feature-discovery/source
Markus Lehtonen f75303ce43 pkg/apis/nfd: add variables to rule spec and support backreferences
Support backreferencing of output values from previous rules. Enables
complex rule setups where custom features are further combined together
to form even more sophisticated higher level labels. The labels created
by preceding rules are available as a special 'rule.matched' feature
(for matchFeatures to use).

If referencing rules accross multiple configs/CRDs care must be taken
with the ordering. Processing order of rules in nfd-worker:

1. Static rules
2. Files from /etc/kubernetes/node-feature-discovery/custom.d/
   in alphabetical order. Subdirectories are processed by reading their
   files in alphabetical order.
3. Custom rules from main nfd-worker.conf

In nfd-master, NodeFeatureRule objects are processed in alphabetical
order (based on their metadata.name).

This patch also adds new 'vars' fields to the rule spec. Like 'labels',
it is a map of key-value pairs but no labels are generated from these.
The values specified in 'vars' are only added for backreferencing into
the 'rules.matched' feature. This may by desired in schemes where the
output of certain rules is only used as intermediate variables for other
rules and no labels out of these are wanted.

An example setup:

  - name: "kernel feature"
    labels:
      kernel-feature:
    matchFeatures:
      - feature: kernel.version
        matchExpressions:
          major: {op: Gt, value: ["4"]}

  - name: "intermediate var feature"
    vars:
      nolabel-feature: "true"
    matchFeatures:
      - feature: cpu.cpuid
        matchExpressions:
          AVX512F: {op: Exists}
      - feature: pci.device
        matchExpressions:
          vendor: {op: In, value: ["8086"]}
          device: {op: In, value: ["1234", "1235"]}

  - name: top-level-feature
    matchFeatures:
      - feature: rule.matched
        matchExpressions:
          kernel-feature: "true"
          nolabel-feature: "true"
2021-11-25 12:50:47 +02:00
..
cpu source/cpu: detect Intel SGX 2021-11-23 15:57:31 +02:00
custom pkg/apis/nfd: add variables to rule spec and support backreferences 2021-11-25 12:50:47 +02:00
fake source: introduce FeatureSource interface 2021-09-20 09:58:07 +03:00
iommu source: introduce FeatureSource interface 2021-09-20 09:58:07 +03:00
kernel source/kernel: don't advertise selinux.enabled=false 2021-11-23 20:12:20 +02:00
local source/local: implement FeatureSource 2021-11-11 18:34:01 +02:00
memory source/memory: fix memory.numa label 2021-11-23 20:35:17 +02:00
network source/network: implement FeatureSource 2021-11-23 10:05:38 +02:00
pci source/pci: implement FeatureSource 2021-11-11 18:33:53 +02:00
storage source/storage: implement FeatureSource 2021-11-18 14:58:33 +02:00
system source/system: implement FeatureSource 2021-11-11 18:33:58 +02:00
usb source/usb: implement FeatureSource 2021-11-11 18:33:53 +02:00
config.go topologyupdater: Bootstrap nfd-topology-updater in NFD 2021-09-21 10:47:39 +01:00
mock_LabelSource.go Merge pull request #602 from marquiz/devel/go-generate 2021-09-21 06:16:24 -07:00
source.go Merge pull request #602 from marquiz/devel/go-generate 2021-09-21 06:16:24 -07:00
source_test.go source/kernel: implement FeatureSource 2021-11-11 18:33:40 +02:00