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

77 commits

Author SHA1 Message Date
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
Markus Lehtonen
63c1256d08 Drop deployment templates
Resort to kustomize, instead. Update docs and scripts, accordingly.

Bump cert-manager version in the deployment instructions to v1.5.1.
2021-08-18 15:10:25 +03:00
Markus Lehtonen
8117c099a3 deployment: add kustomize base
Implement functionality virtually replicating deployment templates for
nfd-master and nfd-worker daemonset (nfd-master.yaml.template and
nfd-worker-daemonset.yaml.template) by adding a kustomize overlay named
"default".

We split the resources into multiple bases (rbac, master and
worker-daemonset) so that relevant parts are re-usable in
other deployment scenarios added later (e.g. "one-shot job", and
"combined daemonset").

This patch adds one component (components/common) doing the required
kustomization for the example deployment.
2021-08-18 14:05:57 +03:00
Markus Lehtonen
0f2554abf1 helm: move files under deployment/helm 2021-08-16 14:44:26 +03:00
Kubernetes Prow Robot
47b1bd8e11
Merge pull request #549 from marquiz/devel/lint
Makefile: add lint target
2021-08-04 10:01:24 -07:00
Markus Lehtonen
d12e62b1fe Makefile: add apigen target
For auto-generating api(s).

Also, re-generate/refresh the gRPC with `make apigen` (with protoc
v3.17.3 and protoc-gen-go from github.com/golang/protobuf v1.5.2) to
sync up things.
2021-07-07 16:01:10 +03:00
Markus Lehtonen
feecee2c3d Makefile: add lint target
Shortcut for running golint.
2021-07-07 10:10:47 +03:00
Markus Lehtonen
34050596d7 test/e2e: adapt e2e tests to kubernetes v1.21.2
Mimic SIGDescribe() from upstream k8s e2e tests.
2021-07-06 14:40:29 +03:00
rmr-silicom
a896ff3011
Add support for configurable runtime full and minimal images. (#513)
* Add support for configurable runtime full and minimal images.

* Fixups and renamings.

* Change variables *_IMG_* to *_IMAGE_*

* Fix args in Dockerfile also.
2021-04-20 00:42:33 -07:00
Mikko Ylinen
ee261b8288 Document cert-manager usage
cert-manager can be used to automate TLS certificate management for
nfd-master and the nfd-worker pod(s).

Add a template to deploy cert-manager CA Issuer and Certificates and
document steps how to use them.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-03-12 09:39:30 +02:00
Markus Lehtonen
1f8d7be6f0 Makefile: run e2e-tests for both variants of the image
Test both the full and minimal image. This might be paranoid but better
be sure(r) than sorry. The end-to-end tests are not that expensive.
2021-03-10 11:10:08 +02:00
Markus Lehtonen
c5dca79a07 Makefile: change poll-image target to poll-images
Poll all images that are supposed to be tagged. Both the "full" and
"minimal" variant, including tags created from IMAGE_EXTRA_TAG_NAMES.
2021-03-10 11:10:08 +02:00
Markus Lehtonen
8fb58a178a Dockerfile: add minimal image
Build a "minimal" variant of the nfd image based on
gcr.io/distroless/base. The motivations behind the minimal image are
image hardening (security) and reducing the image footprint (from ca.
108MB down to about 40MB).

The practical effect of deploying the minimal image is that no runtimes
for running worker hooks are present, not even a shell. This means that
only statically linked linked hook binaries are supported. Also, because
of the image hardening live debugging of the minimal image by attaching
to the container is not possible, and, the "full" image needs to be used
for that purpose.
2021-03-10 11:09:13 +02:00
Markus Lehtonen
9457cfba42 Makefile: increase golangci-lint timeout to 7min
Formerly used 5 minutes caused timeout in Prow.
2021-03-02 20:08:58 +02:00
Markus Lehtonen
34cc407dd9 scripts/test-infra: enable helm linting 2021-02-26 07:24:59 +02:00
Markus Lehtonen
7e6f740c9f test/e2e: make openshift bits optional
Only enabled if OPENSHIFT is specified in the environment when running
make e2e-test, for example:

  $ OPENSHIFT=y make e2e-test
2021-02-25 17:54:07 +02:00
Markus Lehtonen
bc289d0783 docs: enable markdown linting 2021-02-25 15:13:40 +02:00
Adrian Chiris
e80900b8ee Add helm chart for NFD
This commit adds Helm chart for node-feature-discovery

Signed-off-by: Adrian Chiris <adrianc@nvidia.com>
Signed-off-by: Ivan Kolodiazhnyi <ikolodiazhny@nvidia.com>
2021-02-18 17:19:09 +02:00
Markus Lehtonen
569e0f2017 Change the worker conf update mechanism of templates
Rely on markers instead which makes the update work also in the middle
of a template file. Previously it relied on the configuration data to be
at the very end of the file to be updated.
2021-02-04 18:56:55 +02:00
Carlos Eduardo Arango Gutierrez
30e64468de
Makefile: require KUBECONFIG to be specified for e2e-test target
This Patch adds a check on make target e2e-test, to check if the
KUBECONFIG env var is set before running the test suite.

if not pressent return a valid error message.

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-11-24 16:50:55 -05:00
Markus Lehtonen
979d3b88fe Add nfd-worker-conf ConfigMap to deployment templates
Add a virtually empty ConfigMap that is mounted inside the workers.
Makes it easier to start customizing the worker deployment e.g. with just:

  $ kubectl -n ${NFD_NS} edit configmap nfd-worker-conf

Create a new 'templates' make target for inserting the content of
nfd-worker.conf.example into the configmap spec of the templates. Thus,
'make templates' should be run whenever the example config is update.
Update the verify.sh prow script to check that the templates are up to
date.

This patch also streamlines the documentation about configuration
management, reflecting the changes.
2020-11-23 18:49:52 +02:00
Artyom Lukianov
a8c0b4a0d0 Focus only on NFD tests during the e2e tests run
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2020-11-18 13:09:13 +02:00
Markus Lehtonen
7b8e85c4ea docs: fixup site baseurl setting
Change build configuration related to site baseurl and Jekyll output
directory a bit. Making it more coherent e.g. by removing the need to
override baseurl for 'site-serve' makefile target.
2020-11-02 13:51:09 +02:00
Markus Lehtonen
5295feb1ee docs: polish the version menu
Only show the dynamic version menu in production environment where it's
available. Local (development) builds only show a stub version menu with
one item.

Also, fix the theme customization. Append version list items to the
correct element in html so that they are displayed correctly. Drop
unnecessary <div/>.
2020-10-30 08:41:33 +02:00
Markus Lehtonen
5ec91935df Makefile: add rules for building html docs
Add rules for building and serving the html documentation inside a
container.
- 'make site-build' will build the html content unders docs/_site.
- 'make site-serve' builds the site content and serves it at
  http://localhost:4000/
2020-10-08 10:51:13 +03:00
Markus Lehtonen
5d4484a1d9 Makefile: set default deployment ns to node-feature-discovery
Change the default namespace used in deployment yamls from 'kube-system'
to 'node-feature-discovery'. Sync with what the templates have. Also,
this should be a safer and more desirable default for people just trying
out node-feature-discovery.
2020-10-01 13:52:10 +03:00
Markus Lehtonen
890380892d Fix up Makefile variable initialization and documentation
An attempt to organize the Makefile variables a bit further. The idea is
to only document variables that are really intended for build
customization and initialize all these variables in the Makefile with
'=?' so that they can be specified in the environment (and not just with
variable overrides). Thus, this patch drops some variables from the
README and change the initialization of some variables in the Makefile
so that the two files would be in sync.
2020-09-08 16:24:39 +03:00
Carlos Eduardo Arango Gutierrez
4bcb0cf851
Fix Makefile to take vaules from ENV VAR values
make image and make push fails when trying to use an ENV VAR value, as
it is now they can only be overrided.

the Var modified are
GO_CMD
GO_FMT
IMAGE_BUILD_EXTRA_OPTS
IMAGE_BUILD_CMD
IMAGE_PUSH_CMD
IMAGE_TAG_NAME
IMAGE_REGISTRY
IMAGE_NAME
IMAGE_EXTRA_TAG_NAMES
K8S_NAMESPACE
HOSTMOUNT_PREFIX

This new behaviour has also been updated on the README.

Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2020-09-08 07:49:43 -05:00