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

104 commits

Author SHA1 Message Date
Markus Lehtonen
bf99c47458 Bump Go to v1.23
NOTE: api/nfd/go.mod is not bumped. There should be no need to force the
importers of the API to v1.23 (yet).
2024-09-04 09:21:13 +03:00
Markus Lehtonen
b2bc18f5a5 docs: use jekyll-rtd-theme from a ruby gem
The upstream repo (and the release downloads)
github.com/rundocs/jekyll-rtd-theme has been deleted. This broke our
docs generation as the remote theme configuration depended on
downloading the release artefact.

This patch changes the docs building to use a Ruby gem instead of the
remote theme setting. To complicate matters, the gem has an seemingly
incorrect (too strict) version dependency. To mitigate this, we now
install bundler-override plugin to ignore this particular dependency.

The netlify conf is a hack, but I wasn't able to figure out a way how to
install the bundler-override plugin without doing all ruby
initialization in the build command.
2024-08-08 23:33:37 +03:00
Markus Lehtonen
a31fa3ac12 build: specify buildx builder name everywhere
Fixes scenarios where there are other builders, too.
2024-04-26 17:02:02 +03:00
Links2004
8acff5ede6
Add armv7 support
This allows the nfd to run on arm devices like the Raspberry Pi > 2
with armv7 core or armv8 in 32Bit mode.

The build tests will only be run for linux/amd64 and linux/arm64.
Releases will be made for all Platforms.
2024-04-15 16:42:44 +02:00
Carlos Eduardo Arango Gutierrez
dd24e8bc97
Update generate scripts to use latest code_gen functions
Rewrite the generate.sh into update_codegen inspired in
k8s.io/code-generator documentation.

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2024-03-12 11:35:47 +01:00
Markus Lehtonen
de9da1af8b Bump Go to v1.22 2024-02-12 12:53:42 +02:00
Kubernetes Prow Robot
456a77b31a
Merge pull request #1526 from marquiz/devel/e2e-timeout
Makefile: add -timeout argument to e2e-tests
2023-12-22 15:46:43 +01:00
Markus Lehtonen
4d2feca004 makefile: fix build: target
Create binaries under bin/ rather than a binary named bin.
2023-12-22 10:48:15 +02:00
Markus Lehtonen
94ab447931 Makefile: add -timeout argument to e2e-tests
Fixes recently experienced timeouts in e2e-tests. For some reason
-test.timeout was not enough (anymore).
2023-12-22 08:09:02 +02:00
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
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
Markus Lehtonen
c04e022269 Makefile: more verbose output for e2e-tests
Also fixes some indentation,
2023-12-08 19:28:56 +02: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
Markus Lehtonen
e608fdac19 Change the base image of full image variant to Debian Bookworm 2023-12-01 16:38:41 +02:00
Carlos Eduardo Arango Gutierrez
73d624def4
Update Makefile
Co-authored-by: Mikko Ylinen <mikko.ylinen@intel.com>
2023-10-04 18:34:55 +02:00
Carlos Eduardo Arango Gutierrez
3bb687d3d3
Bump to Go 1.21
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2023-10-04 11:39:32 +02:00
Markus Lehtonen
6149000637 Build statically linked binaries
Switch to fully statically linked binaries and use scratch as a base
image.

Switching to the virtually empty scratch base image means that the
default/minimal NFD image only supports running hooks that are truly
statically linked (e.g.  normal go binaries that are "almost" statically
linked stop working).  The documentation has been already stating this
(i.e. that only statically-linked binaries are supported) - i.e. we have
had no promise of supporting other than that. Also, hooks are now
deprecated and even disabled by default so the possibility of real user
impact should be small.
2023-09-19 21:59:18 +03:00
Markus Lehtonen
8985e003b5 docs: use ruby docker image for building docs
Get away with the jekyll:3.8 image which is already four years old.  Use
the ruby instead. The jekyll image did not bring any value (more
problems, if anything) as we install/update jekyll and all other gems
with byndler nevertheless (image was jekyll:3.8 but we use jekyll
v3.9.3).
2023-08-30 19:31:35 +03:00
Markus Lehtonen
2c8a6208f4 Makefile: increase golangci-lint timeout to 10min 2023-08-30 12:53:24 +03:00
AhmedGrati
b3cfe17392 feat: parallelize nodes update
This PR aims to optimize the process of updating nodes with
corresponding features. In fact, previously, we were updating nodes
sequentially even though they are independent from each other.
Therefore, we integrated new components: LabelersNodePool which is
responsible for spininng a goroutine whenever there's a request for
updating nodes, and a Workqueue which is responsible for holding nodes names
that should be updated.

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-06-02 11:41:50 +01:00
Markus Lehtonen
3a1a8d4c6f Makefile: set e2e test timeout to 1 hour
Previously we were using the default, which even if equal to 0, still
means 10 minute timout in practice (with the way we run the tests with
invoking go test directly). With the addition of latest e2e tests we
hit the limit and got bitten by it. Set the timeout to 1 hour which
should be enough for anyone...
2023-04-13 18:57:19 +03:00
AhmedGrati
3fff409f6d Add master config file
Similar to the nfd-worker, in this PR we want to support the
dynamic run-time configurability through a config file for the nfd-master.

We'll use a json or yaml configuration file along with the fsnotify in
order to watch for changes in the config file. As a result, we're
allowing dynamic control of logging params, allowed namespaces,
extended resources, label whitelisting, and denied namespaces.

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-04-03 09:52:09 +01:00
Muyassarov, Feruzjon
82b388fc3b test: add code coverage reporting
Add code coverage reporting so that the report is then available
to the PR author and reviewers via codecov GitHub app.

Signed-off-by: Muyassarov, Feruzjon <feruzjon.muyassarov@intel.com>
2023-03-01 14:34:30 +02:00
Carlos Eduardo Arango Gutierrez
2859d55f9a
GO Update version to 1.20
This patch
- Bumps GO to 1.20
- Updates deps by running "go mod tidy"

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
2023-02-16 10:36:38 +01:00
Markus Lehtonen
cd62f6566f images: base the default image on distroless/base
Make distroless/base as the base image for the default image,
effectively making the minimal image as the default. Add a new "full"
image variant that corresponds the previous default image. The
"*-minimal" container image tag is provided for backwards compatibility.

The practical user impact of this change is that hook support is limited
to statically linked ELF binaries. Bash or Perl scripts are not
supported by the default image, anymore, but the new "full" image
variant can be used for backwards compatibility.
2023-01-31 11:30:38 +02:00
Feruzjon Muyassarov
39813e7a73 E2E: default kubeconfig location to ${HOME}/.kube/config
Signed-off-by: Feruzjon Muyassarov <feruzjon.muyassarov@intel.com>
2022-12-14 17:09:08 +02:00
Talor Itzhak
f832a7e4a8 helm: topology-updater: enable the configuration via helm
- Add a helm template with a config example for the exclude-list.
- Add mount for the topology-updater.conf file
- Update the templates Makefile target

Signed-off-by: Talor Itzhak <titzhak@redhat.com>
2022-11-21 21:31:37 +02:00
Markus Lehtonen
a798b4517d Update base image to Debian bullseye
Update the base used for our "full" image to debian:bullseye-slim. Will
ensure we get the latest and greatest updates and fixes.
2022-10-14 10:04:04 +03:00
Markus Lehtonen
a00cdc2b61 pkg/utils: move hostpath helpers from source to utils
Refactor the code, moving the hostpath helper functionality to new
"pkg/utils/hostpath" package. This breaks odd-ish dependency
"pkg/utils" -> "source".
2022-10-06 14:28:24 +03:00
Markus Lehtonen
97590e200a scripts: move hacky scripts to hack directory
Move prepare-release.sh and kustomize.sh from scripts/ to hack/.
2022-09-13 17:58:09 +03:00
Markus Lehtonen
4f34451db8 Update NFD registry to registry.k8s.io
Kubernetes has moved to a new container image registry:
https://groups.google.com/a/kubernetes.io/g/dev/c/DYZYNQ_A6_c/m/FpHqeVR2BAAJ
2022-09-12 11:21:12 +03:00
Markus Lehtonen
81fbc685df generate: use common builder base image
Use the same base image (golang) for auto-generation as for building
container images. This makes sure that we stay in sync in terms of the
golang version used.
2022-09-08 12:43:15 +03:00
Markus Lehtonen
ba7a3ba3eb Bump golang to v1.19 2022-09-07 15:37:12 +03:00
Feruzjon Muyassarov
1e3bfcc77d Run local markdown tests inside an isolated container
Signed-off-by: Feruzjon Muyassarov <feruzjon.muyassarov@intel.com>
2022-09-06 16:08:06 +03:00
Francesco Romani
622adf3863 test: e2e: configurable pull policy
In some cases (CI) it is useful to run NFD e2e tests using
ephemeral clusters. To save time and bandwidth, it is also useful
to prime the ephemeral cluster with the images under test.

In these circumstances there is no risk of running a stale image,
and having a `Always` PullPolicy hardcoded actually makes
the whole exercise null.

So we add a new option, disabled by default, to make the e2e
manifest use the `IfNotPresent` pull policy, to effectively
cover this use case.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2022-08-10 15:06:59 +02:00
Markus Lehtonen
676d14688c Containerized auto-generation
Run code auto-generation inside a container instead of the host system.
Our auto-generation depends on specific versions of a multitude of tools
(like k8s code-generator, controller-gen, protoc, mockery etc). This
made it really awkward (and error-prone) to run in the host environment,
especially if/when you needed different versions of those tools for
other projects. Making it even more unwieldy, the required versions of
tools were not neatly documented anywhere (except for git commits,
perhaps).

With this patch we have a "fixed environment", as we build a special
auto-generate-builder container which has correct versions of all the
dependencies. Using the container makes auto-generation easy to run
anywhere, independent of the host system, giving reproducibility and
reliability. Also, the patch moves the auto-generation steps out from
the makefile into a separate script, making the makefile cleaner and the
script easier to maintain.
2022-08-10 09:44:43 +03:00
Markus Lehtonen
8d56634761 dockerfile: update builder image to golang v1.18
Switch over to the "non-point-release" version of the image. Now we
always use the latest patch version of golang with latest security
fixes, for example, without the need to manually bump the version after
every point release.

This patch also makes the builder image configurable through a Makefile
variable.

For reproducible builds we should used fixed point-release versions in
release-brances.
2022-07-08 10:04:04 +03:00
Zvonko Kaiser
8414fe8c07 Adding missing target dep 2022-01-20 17:01:54 +01:00
Zvonko Kaiser
c69e47a27a Iniital multi arch build 2022-01-20 15:41:08 +01:00
Kubernetes Prow Robot
4bb2311b5e
Merge pull request #667 from ArangoGutierrez/devel/clean-lables
Add deploy-prune makefile rule to ease devel processes
2021-12-01 06:09:16 -08:00
Carlos Eduardo Arango Gutierrez
f718379ba0
makefile: Add make deploy rule
After https://github.com/kubernetes-sigs/node-feature-discovery/pull/667
adding a rule for also deploying NFD is encouraged.

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2021-11-29 15:11:08 -05:00
Carlos Eduardo Arango Gutierrez
4791bd3a42
Add clean-labels makefile rule to ease devel processes
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2021-11-29 15:01:41 -05:00
Markus Lehtonen
6624ab312b pkg/generated: add code for interacting with CRD API
Add auto-generated code for interfacing our CRD API. On top of this, a
CR controller can be implemented. This patch uses k8s/code-generator
for code generation. Run "make generate" in order to (re-)generate
everything. Path to the code-generator repository may need to be
specified:

  K8S_CODE_GENERATOR=path/to/code-generator make apigen

Code-generator version 0.20.7 was used to create this patch. Install
k8s code-generator tools and clone the repo with:

  git clone https://github.com/kubernetes/code-generator -b v0.20.7 <path/to/code-generator>
  go install k8s.io/code-generator/cmd/...(at)v0.20.7
2021-11-17 18:51:34 +02:00
Markus Lehtonen
c3e2315834 pkg/apis/nfd: specify CRD for custom labeling rules
Add a cluster-scoped Custom Resource Definition for specifying labeling
rules. Nodes (node features, node objects) are cluster-level objects and
thus the natural and encouraged setup is to only have one NFD deployment
per cluster - the set of underlying features of the node stays the same
independent of how many parallel NFD deployments you have. Our extension
points (hooks, feature files and now CRs) can be be used by multiple
actors (depending on us) simultaneously. Having the CRD cluster-scoped
hopefully drives deployments in this direction. It also should make
deployment of vendor-specific labeling rules easy as there is no need to
worry about the namespace.

This patch virtually replicates the source.custom.FeatureSpec in a CRD
API (located in the pkg/apis/nfd/v1alpha1 package) with the notable
exception that "MatchOn" legacy rules are not supported. Legacy rules
are left out in order to keep the CRD simple and clean.

The duplicate functionality in source/custom will be dropped by upcoming
patches.

This patch utilizes controller-gen (from sigs.k8s.io/controller-tools)
for generating the CRD and deepcopy methods. Code can be (re-)generated
with "make generate". Install controller-gen with:

  go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0

Update kustomize and helm deployments to deploy the CRD.
2021-11-17 13:40:23 +02:00
Markus Lehtonen
5c0d98e07a Makefile: let gofmt-verify write changes back to files
Let gofmt write the result (suggested changes) back to the source files,
instead of just printing out the diff. Reduces manual work.
2021-10-22 12:03:24 +03: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
Swati Sehgal
a311719d1e topologyupdater: Updates based on latest changes made to CRD API
There have been recent changes made to the noderesourcetopology API
storing the proto file generated using go-to-protobuf tool and
this code inports the proto generated in the API in the topology-updater.proto
The PRs corresponding to the changes are as follows:
https://github.com/k8stopologyawareschedwg/noderesourcetopology-api/pull/9
https://github.com/k8stopologyawareschedwg/noderesourcetopology-api/pull/13

Commands used to generate topology-updater.pb.go file:

go install github.com/golang/protobuf/protoc-gen-go@v1.4.3
go mod vendor
protoc --go_opt=paths=source_relative  --go_out=plugins=grpc:. pkg/topologyupdater/topology-updater.proto -I. -Ivendor

As part of implmentation of this patch, reserved (non-allocatable) CPUs
are evaluated by performing a difference between all the CPUs on a system
(determined by using ghw) and allocatable CPUs (determined by querying
GetAllocatableResources podResource API endpoint).

When aggregator creates the NUMA zones, it will skip the zone creation if
there are no allocatable resources. In this update we creates those missing
zone with zero allocatable/available resources so we won't have holes in the
array of reported zones.

Co-Authored-by: Talor Itzhak <titzhak@redhat.com>
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2021-09-21 10:48:10 +01:00
Francesco Romani
00cc07da76 topologyupdater: gRPC API definition
Setup the topologyupdater API for gRPC communication of
nfd-topology-updater with master

We generate pb.go file to reflect latest dependency changes
using github.com/golang/protobuf/protoc-gen-go and generate
grpc files via:
`protoc pkg/topologyupdater/topology-updater.proto --go_out=plugins=grpc:.`

Please refer to: https://github.com/k8stopologyawareschedwg/noderesourcetopology-api/blob/master/pkg/apis/topology/v1alpha1/types.go

Co-Authored-by: Artyom Lukianov <alukiano@redhat.com>
Co-Authored-by: Francesco Romani <fromani@redhat.com>
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2021-09-21 10:47:39 +01: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