From 8d2cd8d2ad22afe8424fcc013f190ca807ffcece Mon Sep 17 00:00:00 2001 From: Jack Ding Date: Tue, 20 Sep 2022 14:30:40 -0400 Subject: [PATCH] Fix controller-gen and operator-sdk versions - Update versions of controller-gen and operator-sdk. - Add/fix the installation of controller-gen and operator-sdk in Makefile. - Remove crd options trivialVersions and preserveUnknownFields since they are no longer supported in later version of controller-gen. Signed-off-by: Jack Ding --- Makefile | 24 ++++++++++--------- bundle.Dockerfile | 2 +- .../ptp-operator.clusterserviceversion.yaml | 2 +- .../ptp.openshift.io_nodeptpdevices.yaml | 6 ++--- .../ptp.openshift.io_ptpconfigs.yaml | 6 ++--- .../ptp.openshift.io_ptpoperatorconfigs.yaml | 6 ++--- bundle/metadata/annotations.yaml | 2 +- .../ptp.openshift.io_nodeptpdevices.yaml | 9 +------ .../bases/ptp.openshift.io_ptpconfigs.yaml | 9 +------ .../ptp.openshift.io_ptpoperatorconfigs.yaml | 9 +------ config/rbac/role.yaml | 1 - .../ptp-operator.clusterserviceversion.yaml | 2 +- .../ptp.openshift.io_nodeptpdevices.yaml | 2 +- .../stable/ptp.openshift.io_ptpconfigs.yaml | 2 +- .../ptp.openshift.io_ptpoperatorconfigs.yaml | 2 +- 15 files changed, 32 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 44925b67e..6d95052b3 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +37,6 @@ BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) # Image URL to use all building/pushing image targets IMG ?= quay.io/openshift/origin-ptp-operator:$(VERSION) -# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) -CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false" # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -74,7 +72,7 @@ help: ## Display this help. ##@ Development manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. - $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases + $(CONTROLLER_GEN) crd rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." @@ -130,6 +128,14 @@ CONTROLLER_GEN = $(shell pwd)/bin/controller-gen controller-gen: ## Download controller-gen locally if necessary. $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2) +OPERATOR_SDK = $(shell pwd)/bin/operator-sdk +OPERATOR_SDK_VERSION = $(shell $(OPERATOR_SDK) version 2>/dev/null | sed 's/^operator-sdk version: "\([^"]*\).*/\1/') +OPERATOR_SDK_VERSION_REQ = v1.22.0-ocp +operator-sdk: ## Download operator-sdk locally if necessary. +ifneq ($(OPERATOR_SDK_VERSION_REQ),$(OPERATOR_SDK_VERSION)) + curl https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/operator-sdk/4.11.0/operator-sdk-linux-x86_64.tar.gz? | tar -xz -C bin/ +endif + KUSTOMIZE = $(shell pwd)/bin/kustomize kustomize: ## Download kustomize locally if necessary. $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.7) @@ -149,11 +155,11 @@ rm -rf $$TMP_DIR ;\ endef .PHONY: bundle ## Generate bundle manifests and metadata, then validate generated files. -bundle: manifests kustomize - operator-sdk generate kustomize manifests --interactive=false -q +bundle: operator-sdk manifests kustomize + $(OPERATOR_SDK) generate kustomize manifests --interactive=false -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) - $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION).0 $(BUNDLE_METADATA_OPTS) --extra-service-accounts "linuxptp-daemon" - operator-sdk bundle validate ./bundle + $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION).0 $(BUNDLE_METADATA_OPTS) --extra-service-accounts "linuxptp-daemon" + $(OPERATOR_SDK) bundle validate ./bundle .PHONY: bundle-build ## Build the bundle image. bundle-build: @@ -225,10 +231,6 @@ functests: test-validation-only: SUITE=./test/validation hack/run-functests.sh -# find or download controller-gen -# download controller-gen if necessary -operator-sdk: - go install ./vendor/github.com/operator-framework/operator-sdk/cmd/operator-sdk buildtest: PATH=${PATH}:${GOBIN} ginkgo build ./test/conformance cp ./test/conformance/conformance.test ./bin/testptp diff --git a/bundle.Dockerfile b/bundle.Dockerfile index 921b94185..32ce1bae5 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/ LABEL operators.operatorframework.io.bundle.package.v1=ptp-operator LABEL operators.operatorframework.io.bundle.channels.v1=alpha -LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.14.0+git +LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0-ocp LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1 LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3 diff --git a/bundle/manifests/ptp-operator.clusterserviceversion.yaml b/bundle/manifests/ptp-operator.clusterserviceversion.yaml index 8c86eb8f0..59c9bc387 100644 --- a/bundle/manifests/ptp-operator.clusterserviceversion.yaml +++ b/bundle/manifests/ptp-operator.clusterserviceversion.yaml @@ -67,7 +67,7 @@ metadata: linuxptp processes such as ptp4l, phc2sys and timemaster. olm.skipRange: '>=4.3.0-0 <4.12.0' operators.openshift.io/infrastructure-features: '["disconnected"]' - operators.operatorframework.io/builder: operator-sdk-v1.14.0+git + operators.operatorframework.io/builder: operator-sdk-v1.22.0-ocp operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 provider: Red Hat repository: https://github.com/openshift/ptp-operator diff --git a/bundle/manifests/ptp.openshift.io_nodeptpdevices.yaml b/bundle/manifests/ptp.openshift.io_nodeptpdevices.yaml index a7f5b130b..9e94bd92d 100644 --- a/bundle/manifests/ptp.openshift.io_nodeptpdevices.yaml +++ b/bundle/manifests/ptp.openshift.io_nodeptpdevices.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: nodeptpdevices.ptp.openshift.io spec: @@ -59,5 +59,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: [] - storedVersions: [] + conditions: null + storedVersions: null diff --git a/bundle/manifests/ptp.openshift.io_ptpconfigs.yaml b/bundle/manifests/ptp.openshift.io_ptpconfigs.yaml index 798eedfbf..41d1b4ce1 100644 --- a/bundle/manifests/ptp.openshift.io_ptpconfigs.yaml +++ b/bundle/manifests/ptp.openshift.io_ptpconfigs.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpconfigs.ptp.openshift.io spec: @@ -133,5 +133,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: [] - storedVersions: [] + conditions: null + storedVersions: null diff --git a/bundle/manifests/ptp.openshift.io_ptpoperatorconfigs.yaml b/bundle/manifests/ptp.openshift.io_ptpoperatorconfigs.yaml index 230cfeec6..569ac87bf 100644 --- a/bundle/manifests/ptp.openshift.io_ptpoperatorconfigs.yaml +++ b/bundle/manifests/ptp.openshift.io_ptpoperatorconfigs.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpoperatorconfigs.ptp.openshift.io spec: @@ -71,5 +71,5 @@ status: acceptedNames: kind: "" plural: "" - conditions: [] - storedVersions: [] + conditions: null + storedVersions: null diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml index 93b39d3d9..adcceec2d 100644 --- a/bundle/metadata/annotations.yaml +++ b/bundle/metadata/annotations.yaml @@ -5,7 +5,7 @@ annotations: operators.operatorframework.io.bundle.metadata.v1: metadata/ operators.operatorframework.io.bundle.package.v1: ptp-operator operators.operatorframework.io.bundle.channels.v1: alpha - operators.operatorframework.io.metrics.builder: operator-sdk-v1.14.0+git + operators.operatorframework.io.metrics.builder: operator-sdk-v1.22.0-ocp operators.operatorframework.io.metrics.mediatype.v1: metrics+v1 operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3 diff --git a/config/crd/bases/ptp.openshift.io_nodeptpdevices.yaml b/config/crd/bases/ptp.openshift.io_nodeptpdevices.yaml index 1d80f16e5..751b95909 100644 --- a/config/crd/bases/ptp.openshift.io_nodeptpdevices.yaml +++ b/config/crd/bases/ptp.openshift.io_nodeptpdevices.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: nodeptpdevices.ptp.openshift.io spec: @@ -57,9 +56,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/ptp.openshift.io_ptpconfigs.yaml b/config/crd/bases/ptp.openshift.io_ptpconfigs.yaml index 1249ea12e..06d0cb9f6 100644 --- a/config/crd/bases/ptp.openshift.io_ptpconfigs.yaml +++ b/config/crd/bases/ptp.openshift.io_ptpconfigs.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpconfigs.ptp.openshift.io spec: @@ -131,9 +130,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/crd/bases/ptp.openshift.io_ptpoperatorconfigs.yaml b/config/crd/bases/ptp.openshift.io_ptpoperatorconfigs.yaml index ee17d62ed..a391fc918 100644 --- a/config/crd/bases/ptp.openshift.io_ptpoperatorconfigs.yaml +++ b/config/crd/bases/ptp.openshift.io_ptpoperatorconfigs.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpoperatorconfigs.ptp.openshift.io spec: @@ -69,9 +68,3 @@ spec: storage: true subresources: status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index de4a82ccc..61f1f8b50 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/manifests/stable/ptp-operator.clusterserviceversion.yaml b/manifests/stable/ptp-operator.clusterserviceversion.yaml index 8c86eb8f0..59c9bc387 100644 --- a/manifests/stable/ptp-operator.clusterserviceversion.yaml +++ b/manifests/stable/ptp-operator.clusterserviceversion.yaml @@ -67,7 +67,7 @@ metadata: linuxptp processes such as ptp4l, phc2sys and timemaster. olm.skipRange: '>=4.3.0-0 <4.12.0' operators.openshift.io/infrastructure-features: '["disconnected"]' - operators.operatorframework.io/builder: operator-sdk-v1.14.0+git + operators.operatorframework.io/builder: operator-sdk-v1.22.0-ocp operators.operatorframework.io/project_layout: go.kubebuilder.io/v3 provider: Red Hat repository: https://github.com/openshift/ptp-operator diff --git a/manifests/stable/ptp.openshift.io_nodeptpdevices.yaml b/manifests/stable/ptp.openshift.io_nodeptpdevices.yaml index a7f5b130b..db09d5b0b 100644 --- a/manifests/stable/ptp.openshift.io_nodeptpdevices.yaml +++ b/manifests/stable/ptp.openshift.io_nodeptpdevices.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: nodeptpdevices.ptp.openshift.io spec: diff --git a/manifests/stable/ptp.openshift.io_ptpconfigs.yaml b/manifests/stable/ptp.openshift.io_ptpconfigs.yaml index 798eedfbf..557e6bb42 100644 --- a/manifests/stable/ptp.openshift.io_ptpconfigs.yaml +++ b/manifests/stable/ptp.openshift.io_ptpconfigs.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpconfigs.ptp.openshift.io spec: diff --git a/manifests/stable/ptp.openshift.io_ptpoperatorconfigs.yaml b/manifests/stable/ptp.openshift.io_ptpoperatorconfigs.yaml index 230cfeec6..764f74240 100644 --- a/manifests/stable/ptp.openshift.io_ptpoperatorconfigs.yaml +++ b/manifests/stable/ptp.openshift.io_ptpoperatorconfigs.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.4.1 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: ptpoperatorconfigs.ptp.openshift.io spec: