-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apis/nfd: add matchName field in feature matcher terms #788
apis/nfd: add matchName field in feature matcher terms #788
Conversation
Still a POC/RFC, missing e.g. documentation |
ba69b27
to
727f86f
Compare
727f86f
to
ff69ea4
Compare
ff69ea4
to
62f3672
Compare
still a hold? |
Heh, I'm still a bit unsure do we need this, if anybody wants this 😄 OTOH, it would make it possible to turn all "built-in" labels into In addition, docs are still missing. |
62f3672
to
bc90a9a
Compare
bc90a9a
to
3595986
Compare
/retest |
3595986
to
e6a2f3e
Compare
Rebased |
✅ Deploy Preview for kubernetes-sigs-nfd ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e6a2f3e
to
b28c310
Compare
aacea3f
to
8b9a3c8
Compare
Update:
I think this would be ready for review, no reason to keep it hanging open forever. At least should not have any effect (cause problems) if not used 😉 |
/assign @ArangoGutierrez |
Ach, docs is missing 🙈 (plus unit tests fail) |
03fd03b
to
64e88a4
Compare
Rebased. Added documentation. |
@@ -0,0 +1,112 @@ | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this Samples, should we remove examples
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good question where we should put these 🤔 The examples/
are really supposed to be examples but these are "fully usable" samples that replicate the built-in labels. Maybe these should be put somewhere under deployment/
instead, e.g. deployment/nodefeaturerule/
. Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like deployment/nodefeaturerule/samples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that, then. Better I think
/retest |
/needs-rebase |
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.
Work around a bug in k8s deepcopy-gen.
This patch adds sample NodeFeatureRules that correspond the built-in labels created by nfd-worker (with its default configuration). The samples provide examples on how to utilize NodeFeatureRules and an easy way to modify the labels being generated. In order to replace the built-in node labeling of nfd-worker with these sample rules, all node labeling from nfd-worker must be disabled by setting the "core.labelSources" configuration option to an empty list (or specify "-label-sources= " on the command line). Then, with all nfd-worker side labeling disabled, just apply the rules with kubectl apply -f samples/
64e88a4
to
49886ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v0.15 here we gooo!
/lgtm
LGTM label has been added. Git tree hash: 4714b3d1701ce3b7624f3ff116fc7e8d584dcaea
|
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #788 +/- ##
==========================================
- Coverage 31.39% 31.33% -0.07%
==========================================
Files 59 59
Lines 7555 7647 +92
==========================================
+ Hits 2372 2396 +24
- Misses 4939 5001 +62
- Partials 244 250 +6
|
Too slow 😿 |
OK, see #1504 |
Extend NodeFeatureRule API
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:
An example of a template rule creating a dynamic set of labels based on
the existence of certain kconfig options.
Sample rules
This PR contains also another patch that adds sample NodeFeatureRules that correspond the built-in
labels created by nfd-worker (with its default configuration).
The samples provide examples on how to utilize NodeFeatureRules and an
easy way to modify the labels being generated. In order to replace the
built-in node labeling of nfd-worker with these sample rules, all node
labeling from nfd-worker must be disabled by setting the
core.labelSources
configuration option to an empty list (or specify-label-sources=
on the command line). Then, with all nfd-worker sidelabeling disabled, just apply the rules with