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

18 commits

Author SHA1 Message Date
Markus Lehtonen
bb565c0949 source: allow multi-type features
Allow multiple types of features (flags, attributes, instances) under
the same name.
2024-05-24 13:18:31 +03:00
Carlos Eduardo Arango Gutierrez
3434557d7c
Move NFD api to a separate go mod
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2024-04-05 16:35:47 +02:00
Markus Lehtonen
fe267a634b source: migrate to structured logging
The custom.d config file parsing is made a bit less verbose.
2023-05-31 14:43:08 +03:00
Markus Lehtonen
b907d07d7e apis/nfd: flatten the structure of features data type
Flatten the data structure that stores features, dropping the "domain"
level from the data model. That extra level of hierarchy brought little
benefit but just caused some extra complexity, instead. The new
structure nicely matches what we have in the NodeFeatureRule object (the
matchFeatures field of uses the same flat structure with the "feature"
field having a value <domain>.<feature>, e.g. "kernel.version").

This is pre-work for introducing a new "node feature" CRD that contains
the raw feature data. It makes the life of both users and developers
easier when both CRDs, plus our internal code, handle feature data in a
similar flat structure.
2022-10-18 18:37:28 +03:00
Markus Lehtonen
0e1d4a9046 apis/nfd: migrate pkg/api/feature
Move the previously-protobuf-only internal "feature api" over to the
public "nfd api" package. This is in preparation for introducing a new
CRD API for communicating features.

This patch carries no functional changes. Just moving code around.
2022-10-15 07:42:20 +03:00
Markus Lehtonen
b7658c25fd generate: update mockery to latest version
In order to be able to run it on Go v1.18.
2022-08-10 09:47:23 +03:00
Dipto Chakrabarty
755294184c
Fix GoLinter Issues in the files (#711)
* fix linter issues for few files

* fix linter issue of exported const Name should have comment or be unexported

* fix name lint issue and resolve lints

* add changes to comments
2022-01-18 23:12:06 -08:00
Markus Lehtonen
a6eddbab4f source: rename TestSource to SupplementalSource
Just widen the scope in terms of naming, to cover deprecated and/or
experimental sources too, for example.
2021-12-20 10:05:00 +02:00
Kubernetes Prow Robot
9cf732b64e
Merge pull request #602 from marquiz/devel/go-generate
Utilize go generate
2021-09-21 06:16:24 -07:00
Markus Lehtonen
9487fbeb18 Utilize go generate
Use 'go generate' for auto-generating code. Drop the old 'mock' and
'apigen' makefile targets. Those are replaced with a single
  make generate

which (re-)generates everything.
2021-09-21 13:36:37 +03:00
Markus Lehtonen
852cf4b61d source: introduce FeatureSource interface
Specify a new interface for managing "raw" feature data. This is the
first step to separate raw feature data from node labels. None of the
feature sources implement this interface, yet.

This patch unifies the data format of "raw" features by dividing them
into three different basic types.
- keys, a set of names without any associated values, e.g. CPUID flags
  or loaded kernel modules
- values, a map of key-value pairs, for features with a single value,
  e.g. kernel config flags or os version
- instances, a list of instances each of which has multiple attributes
  (key-value pairs of their own), e.g. PCI or USB devices

The new feature data types are defined in a new "pkg/api/feature"
package, catering decoupling and re-usability of code e.g. within future
extentions of the NFD gRPC API.

Rename the Discover() method of LabelSource interface to GetLabels().
2021-09-20 09:58:07 +03:00
Markus Lehtonen
81378a3235 source: make sources register themselves
Implement new registration infrastructure under the "source" package.
This change loosens the coupling between label sources and the
nfd-worker, making it easier to refactor and move the code around.

Also, create a separate interface (ConfigurableSource) for configurable
feature sources in order to eliminate boilerplate code.

Add safety checks to the sources that they actually implement the
interfaces they should.

In sake of consistency and predictability (of behavior) change all
methods of the sources to use pointer receivers.

Add simple unit tests for the new functionality and include source/...
into make test target.
2021-09-15 18:41:37 +03:00
Markus Lehtonen
befa7e9796 source: rename FeatureSource to LabelSource
Prepare for separating feature detection from label creation.
2021-09-13 22:48:33 +03:00
Markus Lehtonen
1f819173d0 source: drop stale BoolFeatureValue type 2021-03-01 13:51:04 +02:00
Markus Lehtonen
a2b9df5cd3 nfd-worker: rework configuration handling
Extend the FeatureSource interface with new methods for configuration
handling. This enables easier on-the fly reconfiguration of the
feature sources. Further, it simplifies adding config support to feature
sources in the future. Stub methods are added to sources that do not
currently have any configurability.

The patch fixes some (corner) cases with the overrides (--options)
handling, too:
- Overrides were not applied if config file was missing or its parsing
  failed
- Overrides for a certain source did not have effect if an empty config
  for the source was specified in the config file. This was caused by
  the first pass of parsing (config file) setting a nil pointer to the
  source-specific config, effectively detaching it from the main config.
  The second pass would then create a new instance of the source
  specific config, but, this was not visible in the feature source, of
  course.
2020-05-21 00:59:37 +03:00
Markus Lehtonen
640dc9fbf3 source: miscellaneous lint fixes 2020-05-20 21:48:06 +03:00
Markus Lehtonen
56c2ab3d58 Support for non-binary labels
Make it possible to advertise also other than simple 'true' values for
feature labels.
2018-10-10 13:21:49 +03:00
Andy Xie
0ea8ff631e refactor sources to source pkg 2017-09-05 21:35:33 -07:00