From 676d14688c9d1a0b115857c98390ac9934323a58 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 14 Jun 2022 18:02:23 +0300 Subject: [PATCH 1/3] 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. --- Dockerfile_generator | 22 ++++++++++++++++++++++ Makefile | 28 +++++++++++----------------- hack/generate.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 Dockerfile_generator create mode 100755 hack/generate.sh diff --git a/Dockerfile_generator b/Dockerfile_generator new file mode 100644 index 0000000000..ab347b4d3e --- /dev/null +++ b/Dockerfile_generator @@ -0,0 +1,22 @@ +FROM golang:1.18-buster as builder + +# Install tools +RUN go install github.com/vektra/mockery@v1.0.0 && \ + go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 && \ + git clone https://github.com/kubernetes/code-generator -b v0.20.7 --depth 1 && \ + go install k8s.io/code-generator/cmd/...@v0.20.7 && \ + go install golang.org/x/tools/cmd/goimports@v0.1.1 && \ + go install github.com/golang/protobuf/protoc-gen-go@v1.4.3 + +RUN apt-get update && apt-get install unzip + +RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip && \ + unzip protoc-3.17.3-linux-x86_64.zip -d /usr/local && \ + rm protoc-3.17.3-linux-x86_64.zip && \ + chmod a+x /usr/local/bin/protoc && \ + find /usr/local -type d | xargs chmod 755 && \ + find /usr/local -type f | xargs chmod a+r + + +# Expect to be working with nfd +WORKDIR /go/node-feature-discovery diff --git a/Makefile b/Makefile index 2c5819d4d1..4f8562e394 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,6 @@ BASE_IMAGE_MINIMAL ?= gcr.io/distroless/base MDL ?= mdl -K8S_CODE_GENERATOR ?= ../code-generator - # Docker base command for working with html documentation. # Use host networking because 'jekyll serve' is stupid enough to use the # same site url than the "host" it binds to. Thus, all the links will be @@ -129,21 +127,17 @@ templates: -e "}; /$$end/p; d }" -i deployment/helm/node-feature-discovery/values.yaml @rm nfd-worker.conf.tmp -generate: - go mod vendor - go generate ./cmd/... ./pkg/... ./source/... - rm -rf vendor/ - controller-gen object crd output:crd:stdout paths=./pkg/apis/... > deployment/base/nfd-crds/nodefeaturerule-crd.yaml - cp deployment/base/nfd-crds/nodefeaturerule-crd.yaml deployment/helm/node-feature-discovery/manifests/ - rm -rf sigs.k8s.io - $(K8S_CODE_GENERATOR)/generate-groups.sh client,informer,lister \ - sigs.k8s.io/node-feature-discovery/pkg/generated \ - sigs.k8s.io/node-feature-discovery/pkg/apis \ - "nfd:v1alpha1" --output-base=. \ - --go-header-file hack/boilerplate.go.txt - rm -rf pkg/generated - mv sigs.k8s.io/node-feature-discovery/pkg/generated pkg/ - rm -rf sigs.k8s.io +.generator.image.stamp: Dockerfile_generator + $(IMAGE_BUILD_CMD) -t nfd-generator -f Dockerfile_generator . + +generate: .generator.image.stamp + $(CONTAINER_RUN_CMD) --rm \ + -v "`pwd`:/go/node-feature-discovery" \ + -v "`go env GOCACHE`:/.cache" \ + -v "`go env GOMODCACHE`:/go/pkg/mod" \ + --user=`id -u`:`id -g`\ + nfd-generator \ + ./hack/generate.sh gofmt: @$(GO_FMT) -w -l $$(find . -name '*.go') diff --git a/hack/generate.sh b/hack/generate.sh new file mode 100755 index 0000000000..e89e01f9c1 --- /dev/null +++ b/hack/generate.sh @@ -0,0 +1,30 @@ +#!/bin/bash -e +set -o pipefail + +# Default path for code-generator repo +K8S_CODE_GENERATOR=${K8S_CODE_GENERATOR:-../code-generator} + +go mod vendor + +go generate ./cmd/... ./pkg/... ./source/... + +rm -rf vendor/ + +controller-gen object crd output:crd:stdout paths=./pkg/apis/... > deployment/base/nfd-crds/nodefeaturerule-crd.yaml + +cp deployment/base/nfd-crds/nodefeaturerule-crd.yaml deployment/helm/node-feature-discovery/manifests/ + +rm -rf sigs.k8s.io + +${K8S_CODE_GENERATOR}/generate-groups.sh client,informer,lister \ + sigs.k8s.io/node-feature-discovery/pkg/generated \ + sigs.k8s.io/node-feature-discovery/pkg/apis \ + "nfd:v1alpha1" --output-base=. \ + --go-header-file hack/boilerplate.go.txt + +rm -rf pkg/generated + +mv sigs.k8s.io/node-feature-discovery/pkg/generated pkg/ + +rm -rf sigs.k8s.io + From b7658c25fd332f15432ae4433ce8a729f930711b Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 14 Jun 2022 22:28:07 +0300 Subject: [PATCH 2/3] generate: update mockery to latest version In order to be able to run it on Go v1.18. --- Dockerfile_generator | 2 +- pkg/apihelper/apihelpers.go | 2 +- pkg/labeler/doc.go | 2 +- pkg/topologyupdater/doc.go | 2 +- source/source.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile_generator b/Dockerfile_generator index ab347b4d3e..c0865e990d 100644 --- a/Dockerfile_generator +++ b/Dockerfile_generator @@ -1,7 +1,7 @@ FROM golang:1.18-buster as builder # Install tools -RUN go install github.com/vektra/mockery@v1.0.0 && \ +RUN go install github.com/vektra/mockery/v2@v2.13.0 && \ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 && \ git clone https://github.com/kubernetes/code-generator -b v0.20.7 --depth 1 && \ go install k8s.io/code-generator/cmd/...@v0.20.7 && \ diff --git a/pkg/apihelper/apihelpers.go b/pkg/apihelper/apihelpers.go index d3fef4c46b..bfcdec6a71 100644 --- a/pkg/apihelper/apihelpers.go +++ b/pkg/apihelper/apihelpers.go @@ -16,7 +16,7 @@ limitations under the License. package apihelper -//go:generate mockery --name=APIHelpers --inpkg +//go:generate mockery --name=APIHelpers --inpackage import ( topologyclientset "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/generated/clientset/versioned" diff --git a/pkg/labeler/doc.go b/pkg/labeler/doc.go index bc4774157b..4f0e89ade5 100644 --- a/pkg/labeler/doc.go +++ b/pkg/labeler/doc.go @@ -17,4 +17,4 @@ limitations under the License. package labeler //go:generate protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. -I . -I ../.. -I ../../vendor labeler.proto -//go:generate mockery --name=LabelerClient --inpkg +//go:generate mockery --name=LabelerClient --inpackage diff --git a/pkg/topologyupdater/doc.go b/pkg/topologyupdater/doc.go index 689af805c2..b95359c68b 100644 --- a/pkg/topologyupdater/doc.go +++ b/pkg/topologyupdater/doc.go @@ -17,4 +17,4 @@ limitations under the License. package topologyupdater //go:generate protoc --go_opt=paths=source_relative --go_out=plugins=grpc:. -I . -I ../../vendor/ topology-updater.proto -//go:generate mockery --name=NodeTopologyClient --inpkg +//go:generate mockery --name=NodeTopologyClient --inpackage diff --git a/source/source.go b/source/source.go index 489442ba8f..44a725ba82 100644 --- a/source/source.go +++ b/source/source.go @@ -16,7 +16,7 @@ limitations under the License. package source -//go:generate mockery --name=LabelSource --inpkg +//go:generate mockery --name=LabelSource --inpackage import ( "fmt" From ac3030ce48e560711a417081b72e15ee046823f3 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 15 Jun 2022 12:20:49 +0300 Subject: [PATCH 3/3] Re-generate files Refresh auto-generated files using the new conainerized approach. --- pkg/api/feature/generated.pb.go | 2 +- pkg/api/feature/generated.proto | 2 +- pkg/apihelper/mock_APIHelpers.go | 17 ++++++++++++++++- pkg/generated/clientset/versioned/clientset.go | 2 +- pkg/generated/clientset/versioned/doc.go | 2 +- .../versioned/fake/clientset_generated.go | 7 ++----- pkg/generated/clientset/versioned/fake/doc.go | 2 +- .../clientset/versioned/fake/register.go | 2 +- pkg/generated/clientset/versioned/scheme/doc.go | 2 +- .../clientset/versioned/scheme/register.go | 2 +- .../versioned/typed/nfd/v1alpha1/doc.go | 2 +- .../versioned/typed/nfd/v1alpha1/fake/doc.go | 2 +- .../typed/nfd/v1alpha1/fake/fake_nfd_client.go | 2 +- .../nfd/v1alpha1/fake/fake_nodefeaturerule.go | 2 +- .../typed/nfd/v1alpha1/generated_expansion.go | 2 +- .../versioned/typed/nfd/v1alpha1/nfd_client.go | 2 +- .../typed/nfd/v1alpha1/nodefeaturerule.go | 2 +- .../informers/externalversions/factory.go | 2 +- .../informers/externalversions/generic.go | 2 +- .../internalinterfaces/factory_interfaces.go | 2 +- .../informers/externalversions/nfd/interface.go | 2 +- .../externalversions/nfd/v1alpha1/interface.go | 2 +- .../nfd/v1alpha1/nodefeaturerule.go | 2 +- .../listers/nfd/v1alpha1/expansion_generated.go | 2 +- .../listers/nfd/v1alpha1/nodefeaturerule.go | 2 +- pkg/labeler/mock_LabelerClient.go | 17 ++++++++++++++++- pkg/topologyupdater/mock_NodeTopologyClient.go | 17 ++++++++++++++++- source/mock_LabelSource.go | 17 ++++++++++++++++- 28 files changed, 89 insertions(+), 32 deletions(-) diff --git a/pkg/api/feature/generated.pb.go b/pkg/api/feature/generated.pb.go index 33df143ccd..cfe7c772bd 100644 --- a/pkg/api/feature/generated.pb.go +++ b/pkg/api/feature/generated.pb.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/api/feature/generated.proto b/pkg/api/feature/generated.proto index c3ae18b332..9ab6b7ad4b 100644 --- a/pkg/api/feature/generated.proto +++ b/pkg/api/feature/generated.proto @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/apihelper/mock_APIHelpers.go b/pkg/apihelper/mock_APIHelpers.go index 98087ba643..7e677339f5 100644 --- a/pkg/apihelper/mock_APIHelpers.go +++ b/pkg/apihelper/mock_APIHelpers.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.13.0. DO NOT EDIT. package apihelper @@ -172,3 +172,18 @@ func (_m *MockAPIHelpers) UpdateNode(_a0 *kubernetes.Clientset, _a1 *v1.Node) er return r0 } + +type NewMockAPIHelpersT interface { + mock.TestingT + Cleanup(func()) +} + +// NewMockAPIHelpers creates a new instance of MockAPIHelpers. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMockAPIHelpers(t NewMockAPIHelpersT) *MockAPIHelpers { + mock := &MockAPIHelpers{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 58f0e461cc..75330a9d95 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/doc.go b/pkg/generated/clientset/versioned/doc.go index 92576525fa..ab7539cb9f 100644 --- a/pkg/generated/clientset/versioned/doc.go +++ b/pkg/generated/clientset/versioned/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index dd33f2a04d..a38a480cf1 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -74,10 +74,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -var ( - _ clientset.Interface = &Clientset{} - _ testing.FakeClient = &Clientset{} -) +var _ clientset.Interface = &Clientset{} // NfdV1alpha1 retrieves the NfdV1alpha1Client func (c *Clientset) NfdV1alpha1() nfdv1alpha1.NfdV1alpha1Interface { diff --git a/pkg/generated/clientset/versioned/fake/doc.go b/pkg/generated/clientset/versioned/fake/doc.go index 4b91eb6a64..7d98eabcc8 100644 --- a/pkg/generated/clientset/versioned/fake/doc.go +++ b/pkg/generated/clientset/versioned/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index a7846e07af..cdc746791a 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/scheme/doc.go b/pkg/generated/clientset/versioned/scheme/doc.go index 6dc5e6530d..288d3794dc 100644 --- a/pkg/generated/clientset/versioned/scheme/doc.go +++ b/pkg/generated/clientset/versioned/scheme/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index cfac0d743c..b455617b6f 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/doc.go index be4e7e92b5..5362dda2ff 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/doc.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/doc.go index 43eec078a4..dd9e9e4c8f 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/doc.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nfd_client.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nfd_client.go index 8bf3fc196a..7133268330 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nfd_client.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nfd_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go index 7710634ef1..b4afd87f99 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/fake/fake_nodefeaturerule.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/generated_expansion.go index 965bc1eff4..8807cd64dd 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nfd_client.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nfd_client.go index 1858451d17..653f75df21 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nfd_client.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nfd_client.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go index 176e7410b3..d7d4428adf 100644 --- a/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go +++ b/pkg/generated/clientset/versioned/typed/nfd/v1alpha1/nodefeaturerule.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 5a65015deb..e64a77d356 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 18dd6de9bc..453de7f151 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go index f63a11b79c..0b862ce98d 100644 --- a/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go +++ b/pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/nfd/interface.go b/pkg/generated/informers/externalversions/nfd/interface.go index a7d35dca09..8130adf7d8 100644 --- a/pkg/generated/informers/externalversions/nfd/interface.go +++ b/pkg/generated/informers/externalversions/nfd/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/nfd/v1alpha1/interface.go b/pkg/generated/informers/externalversions/nfd/v1alpha1/interface.go index 6c8c39d324..5f476d8873 100644 --- a/pkg/generated/informers/externalversions/nfd/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/nfd/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/informers/externalversions/nfd/v1alpha1/nodefeaturerule.go b/pkg/generated/informers/externalversions/nfd/v1alpha1/nodefeaturerule.go index bb3b23c9e9..6879a711d9 100644 --- a/pkg/generated/informers/externalversions/nfd/v1alpha1/nodefeaturerule.go +++ b/pkg/generated/informers/externalversions/nfd/v1alpha1/nodefeaturerule.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/nfd/v1alpha1/expansion_generated.go b/pkg/generated/listers/nfd/v1alpha1/expansion_generated.go index 64eee10f91..a072a4f4ae 100644 --- a/pkg/generated/listers/nfd/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/nfd/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/generated/listers/nfd/v1alpha1/nodefeaturerule.go b/pkg/generated/listers/nfd/v1alpha1/nodefeaturerule.go index 68e37951d8..e214509134 100644 --- a/pkg/generated/listers/nfd/v1alpha1/nodefeaturerule.go +++ b/pkg/generated/listers/nfd/v1alpha1/nodefeaturerule.go @@ -1,5 +1,5 @@ /* -Copyright 2021 The Kubernetes Authors. +Copyright 2022 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pkg/labeler/mock_LabelerClient.go b/pkg/labeler/mock_LabelerClient.go index 3638308c04..3d16340628 100644 --- a/pkg/labeler/mock_LabelerClient.go +++ b/pkg/labeler/mock_LabelerClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.13.0. DO NOT EDIT. package labeler @@ -44,3 +44,18 @@ func (_m *MockLabelerClient) SetLabels(ctx context.Context, in *SetLabelsRequest return r0, r1 } + +type NewMockLabelerClientT interface { + mock.TestingT + Cleanup(func()) +} + +// NewMockLabelerClient creates a new instance of MockLabelerClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMockLabelerClient(t NewMockLabelerClientT) *MockLabelerClient { + mock := &MockLabelerClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/topologyupdater/mock_NodeTopologyClient.go b/pkg/topologyupdater/mock_NodeTopologyClient.go index 632869419f..3ee715c274 100644 --- a/pkg/topologyupdater/mock_NodeTopologyClient.go +++ b/pkg/topologyupdater/mock_NodeTopologyClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.13.0. DO NOT EDIT. package topologyupdater @@ -44,3 +44,18 @@ func (_m *MockNodeTopologyClient) UpdateNodeTopology(ctx context.Context, in *No return r0, r1 } + +type NewMockNodeTopologyClientT interface { + mock.TestingT + Cleanup(func()) +} + +// NewMockNodeTopologyClient creates a new instance of MockNodeTopologyClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMockNodeTopologyClient(t NewMockNodeTopologyClientT) *MockNodeTopologyClient { + mock := &MockNodeTopologyClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/source/mock_LabelSource.go b/source/mock_LabelSource.go index 404beb44d8..1c9606279e 100644 --- a/source/mock_LabelSource.go +++ b/source/mock_LabelSource.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.13.0. DO NOT EDIT. package source @@ -59,3 +59,18 @@ func (_m *MockLabelSource) Priority() int { return r0 } + +type NewMockLabelSourceT interface { + mock.TestingT + Cleanup(func()) +} + +// NewMockLabelSource creates a new instance of MockLabelSource. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewMockLabelSource(t NewMockLabelSourceT) *MockLabelSource { + mock := &MockLabelSource{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}