diff --git a/Makefile b/Makefile index 0f6a3deb8..9351daf6b 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen GINKGO := $(TOOLS_BIN_DIR)/ginkgo ENVSUBST := $(TOOLS_BIN_DIR)/envsubst MOCKGEN := $(TOOLS_BIN_DIR)/mockgen +CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen STAGING_REGISTRY ?= gcr.io/k8s-staging-capi-ibmcloud STAGING_BUCKET ?= artifacts.k8s-staging-capi-ibmcloud.appspot.com @@ -100,7 +101,7 @@ deploy: manifests $(KUSTOMIZE) $(KUSTOMIZE) build config/default | kubectl apply -f - # Generate manifests e.g. CRD, RBAC etc. -manifests: controller-gen +manifests: $(CONTROLLER_GEN) $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crd/bases @@ -124,7 +125,7 @@ vet: go vet ./... # Generate code -generate: controller-gen +generate: $(CONTROLLER_GEN) $(MAKE) generate-go $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." @@ -133,22 +134,6 @@ generate-go: $(MOCKGEN) go generate ./... images: docker-build -# find or download controller-gen -# download controller-gen if necessary -controller-gen: -ifeq (, $(shell which controller-gen)) - @{ \ - set -e ;\ - CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ - cd $$CONTROLLER_GEN_TMP_DIR ;\ - go mod init tmp ;\ - go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1 ;\ - rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ - } -CONTROLLER_GEN=$(GOBIN)/controller-gen -else -CONTROLLER_GEN=$(shell which controller-gen) -endif ## -------------------------------------- ## Linting diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml index 14faa2275..8299157f0 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmpowervsclusters.infrastructure.cluster.x-k8s.io spec: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml index 6f0d39b17..af6dffbf9 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmpowervsmachines.infrastructure.cluster.x-k8s.io spec: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml index ff205ae1f..e92154c28 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmpowervsmachinetemplates.infrastructure.cluster.x-k8s.io spec: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml index 94d4ab415..61ea36ce7 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmvpcclusters.infrastructure.cluster.x-k8s.io spec: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml index 6d7a5ca70..4d4581c08 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmvpcmachines.infrastructure.cluster.x-k8s.io spec: diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml index ff64a9242..2c4d6f64d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.6.1 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: ibmvpcmachinetemplates.infrastructure.cluster.x-k8s.io spec: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 2dd30e534..e2d51b574 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -1,4 +1,3 @@ - --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index bbcee5355..551bdd2bf 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -1,4 +1,3 @@ - --- apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration @@ -132,7 +131,6 @@ webhooks: resources: - ibmvpcmachinetemplates sideEffects: None - --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration diff --git a/hack/tools/Makefile b/hack/tools/Makefile index a52fb42c2..d3154f223 100644 --- a/hack/tools/Makefile +++ b/hack/tools/Makefile @@ -90,3 +90,7 @@ $(ENVSUBST): $(BIN_DIR) go.mod go.sum MOCKGEN := $(BIN_DIR)/mockgen $(MOCKGEN): $(BIN_DIR) go.mod go.sum go build -tags=tools -o $@ github.com/golang/mock/mockgen + +CONTROLLER_GEN := $(BIN_DIR)/controller-gen +$(CONTROLLER_GEN): $(BIN_DIR) go.mod go.sum + go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen diff --git a/hack/tools/go.mod b/hack/tools/go.mod index bab55c937..bb6ac7b99 100644 --- a/hack/tools/go.mod +++ b/hack/tools/go.mod @@ -13,7 +13,7 @@ require ( k8s.io/code-generator v0.23.0 sigs.k8s.io/cluster-api/hack/tools v0.0.0-20211118171502-aafa086da595 sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9 - sigs.k8s.io/controller-tools v0.7.1-0.20211110210727-ab52f76cc7d1 + sigs.k8s.io/controller-tools v0.8.0 sigs.k8s.io/kustomize/kustomize/v4 v4.4.1 ) diff --git a/hack/tools/go.sum b/hack/tools/go.sum index 8e6c0e695..4c4eda9df 100644 --- a/hack/tools/go.sum +++ b/hack/tools/go.sum @@ -1625,8 +1625,9 @@ sigs.k8s.io/cluster-api/hack/tools v0.0.0-20211118171502-aafa086da595 h1:zh9QwVI sigs.k8s.io/cluster-api/hack/tools v0.0.0-20211118171502-aafa086da595/go.mod h1:Bib3nYZoRjwPdZ1+X1MVRWcQL18dJ4q2U+Ok603lcAE= sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9 h1:ylYUI5uaq/guUFerFRVG81FHSA5/3+fERCE1RQbQUZ4= sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20211110210527-619e6b92dab9/go.mod h1:+sJcI1F0QI0Cv+8fp5rH5B2fK1LxzrAQqYnaPx9nY8I= -sigs.k8s.io/controller-tools v0.7.1-0.20211110210727-ab52f76cc7d1 h1:fsnXNyvliKAKkcOZ5l9gGinGqjGM8eKKT+4TW/LoI7A= sigs.k8s.io/controller-tools v0.7.1-0.20211110210727-ab52f76cc7d1/go.mod h1:h59umkqeBKj3TNpLmLoqDCwXDcbN+mkhQzlNjoUDJ3I= +sigs.k8s.io/controller-tools v0.8.0 h1:uUkfTGEwrguqYYfcI2RRGUnC8mYdCFDqfwPKUcNJh1o= +sigs.k8s.io/controller-tools v0.8.0/go.mod h1:qE2DXhVOiEq5ijmINcFbqi9GZrrUjzB1TuJU0xa6eoY= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= sigs.k8s.io/kubebuilder/docs/book/utils v0.0.0-20211028165026-57688c578b5d h1:KLiQzLW3RZJR19+j4pw2h5iioyAyqCkDBEAFdnGa3N8=