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 fe412a54b9 apis/nfd: add matchName field in feature matcher terms
Extend the format of feature matcher terms (the elements of the
arrayspecified under under matchFeatures field) with new matchName
field. The value of this field is an expression that is evaluated
against the names of feature elements instead of their values (values
are matched with the matchExpressions field, instead).

The matchName field is useful e.g. in template rules for creating
per-feature-element labels based on feature names (instead of values)
and in non-template rules for checking if (at least) one of certain
feature element names are present.

If both matchExpressions and matchName for certain feature matcher term
is specified, they both must match in order to get an overall match.
Also, in this case the list of matched features (used in templating) is
the union of the results from matchExpressions and matchName.

An example of creating an "avx512" label if any AVX512* CPUID feature is
present:

  - name: "avx wildcard rule"
    labels:
        avx512: "true"
    matchFeatures:
      - feature: cpu.cpuid
        matchName: {op: InRegexp, value: ["^AVX512"]}

An example of a template rule creating a dynamic set of labels  based on
the existence of certain kconfig options.

  - name: "kconfig template rule"
    labelsTemplate: |
      {{ range .kernel.config }}kconfig-{{ .Name }}={{ .Value }}
      {{ end }}
    matchFeatures:
      - feature: kernel.config
        matchName: {op: In, value: ["SWAP", "X86", "ARM"]}

NOTE: this patch changes the corner case of nil/null match expressions
with instance features (i.e. "matchExpressions: null"). Previously, we
returned all instances for templating but now a nil match expression is
not evaluated and no instances for templating are returned.
2023-12-15 11:32:23 +02:00
..
cpu cpu: drop the deprecated sgx and se labels 2023-09-08 14:28:04 +03:00
custom apis/nfd: add matchName field in feature matcher terms 2023-12-15 11:32:23 +02:00
fake pkg/utils: migrate KlogDump to structured logging 2023-05-31 14:43:08 +03:00
kernel pkg/utils: migrate KlogDump to structured logging 2023-05-31 14:43:08 +03:00
local feat: support raw features 2023-10-04 22:37:42 +01:00
memory pkg/utils: migrate KlogDump to structured logging 2023-05-31 14:43:08 +03:00
network docs: add network.virtual in customization guide 2023-11-09 16:44:30 +01:00
pci Use generics for maps and slices 2023-12-13 12:09:53 +02:00
storage pkg/utils: migrate KlogDump to structured logging 2023-05-31 14:43:08 +03:00
system pkg/utils: migrate KlogDump to structured logging 2023-05-31 14:43:08 +03:00
usb Use generics for maps and slices 2023-12-13 12:09:53 +02:00
mock_LabelSource.go generate: bump tools to their latest versions 2023-07-27 14:29:48 +03:00
source.go source: migrate to structured logging 2023-05-31 14:43:08 +03:00
source_test.go pkg/api/feature: rename types 2022-10-06 11:25:01 +03:00