1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00
Commit graph

2489 commits

Author SHA1 Message Date
Carlos Eduardo Arango Gutierrez
57b6035b71
Add kubectl-nfd
kubectl-nfd is a kubectl plugin for debbuging NodeFeatureRules

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2023-12-21 16:00:19 +01:00
Markus Lehtonen
d54972fb7c docs: fix malformed hyperlink syntax 2023-12-21 16:38:14 +02:00
Markus Lehtonen
ed7dbe2411 docs: document new x86 cpuid features
Document the Intel APX and AVX10 features that were added with cpuid
v2.2.6.
2023-12-21 15:05:10 +02:00
Kubernetes Prow Robot
bca027a386
Merge pull request #1514 from marquiz/devel/docs-image-variants
docs: use default instead of minimal image variant
2023-12-21 07:57:27 +01:00
Markus Lehtonen
f49e0a43c0 docs: use default instead of minimal image variant 2023-12-20 23:48:34 +02:00
Kubernetes Prow Robot
1a5659f9cc
Merge pull request #1509 from marquiz/devel/deps-k8s
go.mod: bump kubernetes to v1.29
2023-12-20 15:13:44 +01:00
Markus Lehtonen
ea68017af6 test/e2e: replace k8s.io/utils/pointer package
Use "k8s.io/utils/ptr" instead of the deprecated "k8s.io/utils/pointer".
2023-12-20 15:12:11 +02:00
Markus Lehtonen
f199e3276b go.mod: bump kubernetes to v1.29 2023-12-20 14:40:52 +02:00
Kubernetes Prow Robot
9de86b0aa0
Merge pull request #1508 from marquiz/devel/api-refactor
apis/nfd: split rule processing into a separate package
2023-12-20 12:52:08 +01:00
Markus Lehtonen
97bf841140 apis/nfd: split rule processing into a separate package
This patch tidies up the nfdv1alpha1 API package by refactoring out the
implementation of (NodeFeature)Rule evaluation into a separate package.
2023-12-20 12:52:15 +02:00
Kubernetes Prow Robot
e162540e54
Merge pull request #1507 from kubernetes-sigs/dependabot/go_modules/golang.org/x/crypto-0.17.0
build(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0
2023-12-19 09:25:13 +01:00
dependabot[bot]
7c44e12b92
build(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 00:09:49 +00:00
Kubernetes Prow Robot
8f9dc32e0b
Merge pull request #1506 from gyuho/fix-typo-in-error-message
chore(nfd-worker): fix minor typo in wrong label value format error
2023-12-18 19:50:19 +01:00
Gyuho Lee
ed0418b81c
chore(nfd-worker): fix minor typo in wrong label value format error
Signed-off-by: Gyuho Lee <gyuho@lepton.ai>
2023-12-19 02:29:37 +08:00
AhmedGrati
f962698c14 chore: combine cpu count and thread_siblings functions into discover topology function
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-12-18 16:29:38 +01:00
Kubernetes Prow Robot
7ae25167fe
Merge pull request #1479 from marquiz/devel/api-internal
source/custom: add internal rule api
2023-12-18 16:17:55 +01:00
Markus Lehtonen
b28d5c1557 apis/nfd: drop unused validate function 2023-12-18 15:19:19 +02:00
Markus Lehtonen
74bc3bb2a8 apis/nfd: drop custom unmarshaller functions
Not needed in the external API.
2023-12-18 15:19:19 +02:00
Markus Lehtonen
a8092927fc source/custom: use internal api for config parsing
Change the custom feature source of nfd-worker to use the newly added
internal config API for its own configuration. It now uses the internal
types for json/yaml unmarshalling but converts them to external
nfdv1alpha1 API to do the actual rule matching as the internal API does
not duplicate that functionality.
2023-12-18 15:19:19 +02:00
Markus Lehtonen
185b406ee7 source/custom: add internal rule api
Add internal API for the nfd-worker custom feature source rule
configuration. This API has already diverged from the NFD
NodeFeatureRule API in that annotations, extended resources or taints
are not supported. This patch basically copies the Rule type (and it's
sub-types) from the nfdv1alpha1 package. It also adds conversion
functions from the internal rule API to the "external" nfdv1alpha1 API.
This is done to use the same rule matching functionality (from the
nfdv1alpha1 package).

One notable remark is that the feature source rule config supports some
custom formatting (short forms, multi-type fields) that relies on
special json/yaml unmarshalling functions that are better to nuke from
the nfdv1alpha1 package (in another patch). These (legacy) syntax
specialities are most probably used by nobody but let's keep them as
they're already there.  Unit tests to cover the custom json
unmarshalling are now added.
2023-12-18 15:19:19 +02:00
Kubernetes Prow Robot
884edc67eb
Merge pull request #1477 from marquiz/devel/api-cleanup
apis/nfd: drop the private template caching fields
2023-12-15 15:42:31 +01:00
Kubernetes Prow Robot
3ea2a38d73
Merge pull request #1497 from AhmedGrati/feat-add-cpu-socket-number
feat: add cpu socket count in `cpu.topology`
2023-12-15 13:29:51 +01:00
Kubernetes Prow Robot
b47b1a62e9
Merge pull request #1504 from marquiz/devel/wildcard-rule-ng
Document the NodeFeatureRule samples and move them under deployment dir
2023-12-15 13:11:01 +01:00
Markus Lehtonen
84fa1ed6e1 Document the NodeFeatureRule samples and move them under deployment dir 2023-12-15 13:43:26 +02:00
Kubernetes Prow Robot
119e2a374b
Merge pull request #788 from marquiz/devel/wildcard-rule-ng
apis/nfd: add matchName field in feature matcher terms
2023-12-15 12:30:00 +01:00
AhmedGrati
ebb08369d3 feat: add cpu socket number in cpu.topology
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-12-15 11:04:42 +01:00
Markus Lehtonen
49886ed635 Add sample NodeFeatureRules for all built-in labels
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/
2023-12-15 11:32:23 +02:00
Markus Lehtonen
912c7dcf2c apis/nfd: fix an error in auto-generated code
Work around a bug in k8s deepcopy-gen.
2023-12-15 11:32:23 +02:00
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
Markus Lehtonen
b2d9e15a00 apis/nfd: drop the private template caching fields
Drop the private fields – that were supposed to be used for caching parsed
templates – from the Rule type. Keep the API typedefs cleaner and
simpler. Moreover, the caching was not even used in practice,
effectively complicating code without any benefit: the way the types
are used in nfd-master creates a local copy of Rule type storing the
cached template in the copy, wasting it from any future users.

There are also other possible caveats in caching like we tried to do it.
For example the objects returned by the api lister are supposed to be
treated as read-only - in particular if we would be to modify them there
should at least be proper locking in place as nfd-master potentially
processes the same rule (the same Go object) in parallel for multiple
nodes. If any optimization like this will be pursued it should be done
properly, probably with private type(s) at the consumer's end, not
contaminating the API types.
2023-12-15 10:48:07 +02:00
Kubernetes Prow Robot
443ff80748
Merge pull request #1481 from marquiz/devel/api-creation-funcs
apis/nfd: drop creation helper functions
2023-12-14 18:41:18 +01:00
Markus Lehtonen
0bc1b6c28f apis/nfd: drop creation helper functions
Drop the creation helper functions as one step in an effort to tidy up
the api package. These functions were not much used outside unit tests
anyway, the static rules of the nfd-worker custom feature source being
the only exception (and if those happened to be invalid we'd catch that
e.g. in the e2e-tests).
2023-12-14 15:54:51 +02:00
Kubernetes Prow Robot
3ce5a1b218
Merge pull request #1482 from marquiz/devel/api-cleanup-2
apis/nfd: drop the private regexp caching field
2023-12-14 12:08:58 +01:00
Kubernetes Prow Robot
f0d3bce8c6
Merge pull request #1503 from marquiz/devel/maps
Use generics for maps and slices
2023-12-14 11:37:06 +01:00
Markus Lehtonen
cb0a46ec0e Use generics for maps and slices 2023-12-13 12:09:53 +02:00
Kubernetes Prow Robot
6ef153e4c3
Merge pull request #1502 from marquiz/devel/maps
Use non-exp maps package
2023-12-12 17:14:05 +01:00
Markus Lehtonen
8e477cdfa4 Use non-exp maps package
The maps package became available as a standard non-experimental package
in Go 1.21.
2023-12-12 17:31:25 +02:00
Kubernetes Prow Robot
605c66974a
Merge pull request #1501 from marquiz/devel/fix-deny-ns
nfd-master: remove default denied ns from config
2023-12-12 15:29:54 +01:00
Markus Lehtonen
a77983556f nfd-master: remove default denied ns from config
These are now handled by the validate package. If we have them here in
nfd-master, the default namespace (feature.node.kubernetes.io) gets
denied.
2023-12-12 16:12:53 +02:00
Kubernetes Prow Robot
efe5c03071
Merge pull request #1455 from ArangoGutierrez/validation
Create a Validate pkg
2023-12-12 11:04:06 +01:00
Kubernetes Prow Robot
c0d79051c0
Merge pull request #1500 from marquiz/devel/makefile-fix-e2e
Makefile: fix e2e-testing of the full image
2023-12-12 10:44:09 +01:00
Markus Lehtonen
4ebe58ffd9 Makefile: fix e2e-testing of the full image
Fix syntax error in the shell code. Also enable verbosity to print out
the shell script being run.
2023-12-12 11:25:03 +02:00
Kubernetes Prow Robot
795c35683d
Merge pull request #1499 from marquiz/devel/deps
go.mod: update dependencies
2023-12-11 17:21:43 +01:00
Carlos Eduardo Arango Gutierrez
affb93ea50
Create a Validate pkg
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2023-12-11 16:54:22 +01:00
Markus Lehtonen
c1c078e124 go.mod: update dependencies 2023-12-11 14:42:35 +02:00
Kubernetes Prow Robot
9a5b2447b6
Merge pull request #1498 from marquiz/devel/e2e-makefile
Makefile: more verbose output for e2e-tests
2023-12-08 19:48:29 +01:00
Markus Lehtonen
c04e022269 Makefile: more verbose output for e2e-tests
Also fixes some indentation,
2023-12-08 19:28:56 +02:00
Kubernetes Prow Robot
794630f7df
Merge pull request #1489 from ArangoGutierrez/ginkofocus
Makefile: add env var controls to make test targets configurable
2023-12-08 18:24:20 +01:00
Kubernetes Prow Robot
fae0825cae
Merge pull request #1496 from marquiz/devel/fix-e2e
test/e2e: fix broken test
2023-12-08 17:53:49 +01:00
Carlos Eduardo Arango Gutierrez
f9195ef6a4
Makefile: add env var controls to make test targets configurable
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2023-12-08 17:48:00 +01:00