1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-09 10:17:04 +00:00
node-feature-discovery/pkg/apis/nfd/v1alpha1
Markus Lehtonen 63c22551df apis/nfd: fix multiple matcher terms targeting the same feature
Fix NodeFeatureRule templating in cases where multiple matchFeatures
terms are targeting the same feature. Previously, only matched feature
elements from the last matcher terms were used as the input to the
template. However, the input should contain all matched elements from
all matcher terms.

For example, consider the example rule snippet below:

  ...
  labelsTemplate: |
    {{ range .pci.device }}vendor.io/pci-device.{{ .class }}-{{ .device }}=exists
    {{ end }}
  matchFeatures:
    - feature: pci.device
      matchExpressions:
        class: {op: InRegexp, value: ["^03"]}
        vendor: {op: In, value: ["1234"]}
    - feature: pci.device
      matchExpressions:
        class: {op: InRegexp, value: ["^12"]}

This rule matches if both a pci device of class 03 from vendor 1234
exists and a pci device of class 12 (from any vendor) exists.
Previously, the template would only generate labels from the devices in
class 12 (as that's the last term). With this patch the template creates
device labels from devices in both classes 03 and 12.
2023-11-22 10:43:52 +02:00
..
annotations_labels.go Discover node features as annotations 2023-10-25 19:58:58 +02:00
doc.go apis/nfd: migrate pkg/api/feature 2022-10-15 07:42:20 +03:00
expression.go apis/nfd: fix multiple matcher terms targeting the same feature 2023-11-22 10:43:52 +02:00
expression_test.go apis/nfd: fix multiple matcher terms targeting the same feature 2023-11-22 10:43:52 +02:00
feature.go apis/nfd: add unit tests for Feature type 2023-04-25 19:40:35 +03:00
feature_test.go apis/nfd: add unit tests for Feature type 2023-04-25 19:40:35 +03:00
generate.sh apis/nfd: migrate pkg/api/feature 2022-10-15 07:42:20 +03:00
generated.pb.go update re-generated code with make-generate results 2023-03-11 22:15:11 +02:00
generated.proto update re-generated code with make-generate results 2023-03-11 22:15:11 +02:00
register.go apis/nfd: add CRD for communicating node features 2022-12-14 07:31:28 +02:00
rule.go apis/nfd: fix multiple matcher terms targeting the same feature 2023-11-22 10:43:52 +02:00
rule_test.go apis/nfd: fix multiple matcher terms targeting the same feature 2023-11-22 10:43:52 +02:00
types.go Discover node features as annotations 2023-10-25 19:58:58 +02:00
zz_generated.deepcopy.go apis/nfd: fix multiple matcher terms targeting the same feature 2023-11-22 10:43:52 +02:00