node-feature-discovery
node-feature-discovery copied to clipboard
apis/nfd: allow different types of features of the same name
This patch changes the handling of NodeFeatureRules so that one feature name (say "cpu.cpuid") can hold different types of features (flags, attributes and/or instances). Requiring features to choose one single type has not been a limitation of the API itself (and there has been no validation on this) but an implementation decision.
The new evalutation logic of match expressions is such that "flags" and "attributes" are basically evaluated as an union - they are both maps but "flags" just don't have any value associated with the key. However, "instances" are handled separately as that is basically an array of maps and needs to be evaluated in a different way (loop over the array of instances and evaluate expressions against the attributes of each). Because of this difference care must be taken if mixing "instance" features with "flag" and/or "attribute" features.
Note that the API types or their validation is not changed - just the implementation of how the NodeFeatureRules are evaluated.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: marquiz
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [marquiz]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Deploy Preview for kubernetes-sigs-nfd ready!
| Name | Link |
|---|---|
| Latest commit | bb565c094919352c7e05904ecc166abf2c07a34e |
| Latest deploy log | https://app.netlify.com/sites/kubernetes-sigs-nfd/deploys/665069b10d12d50008674b32 |
| Deploy Preview | https://deploy-preview-1671--kubernetes-sigs-nfd.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Cherry-picked #1672 here to make this buildable
Rebased. Test coverage increased.
/assign @ArangoGutierrez
Codecov Report
Attention: Patch coverage is 84.95575% with 17 lines in your changes are missing coverage. Please review.
Project coverage is 40.37%. Comparing base (
c2e3de6) to head (e32d43d).
:exclamation: Current head e32d43d differs from pull request most recent head c693f61. Consider uploading reports for the commit c693f61 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #1671 +/- ##
==========================================
+ Coverage 39.84% 40.37% +0.52%
==========================================
Files 80 80
Lines 6841 6913 +72
==========================================
+ Hits 2726 2791 +65
- Misses 3861 3867 +6
- Partials 254 255 +1
| Files | Coverage Ξ | |
|---|---|---|
| pkg/apis/nfd/nodefeaturerule/rule.go | 86.25% <100.00%> (+4.22%) |
:arrow_up: |
| source/source.go | 38.33% <ΓΈ> (+1.82%) |
:arrow_up: |
| pkg/apis/nfd/nodefeaturerule/expression.go | 80.79% <83.16%> (-0.91%) |
:arrow_down: |
ping @ArangoGutierrez
LGTM label has been added.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: ArangoGutierrez, marquiz
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [ArangoGutierrez,marquiz]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Codecov Report
Attention: Patch coverage is 84.54545% with 17 lines in your changes are missing coverage. Please review.
Project coverage is 39.60%. Comparing base (
c2e3de6) to head (bb565c0). Report is 39 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1671 +/- ##
==========================================
- Coverage 39.84% 39.60% -0.25%
==========================================
Files 80 80
Lines 6841 7141 +300
==========================================
+ Hits 2726 2828 +102
- Misses 3861 4054 +193
- Partials 254 259 +5
| Files | Coverage Ξ | |
|---|---|---|
| pkg/apis/nfd/nodefeaturerule/rule.go | 74.59% <100.00%> (-7.43%) |
:arrow_down: |
| source/source.go | 38.33% <ΓΈ> (+1.82%) |
:arrow_up: |
| pkg/apis/nfd/nodefeaturerule/expression.go | 81.70% <83.16%> (+<0.01%) |
:arrow_up: |