From 934d940157b9e98f27b05d7f33d02480fa9929be Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Wed, 24 May 2023 09:33:03 -0400 Subject: [PATCH 1/2] add IMAGE_DEFAULT pattern to makefile Change-Id: I763467934345a99764d9de57d2e4040b0d6084a2 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5f9090d8..867df54f 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,8 @@ ifeq ($(USE_IMAGE_DIGESTS), true) endif # Image URL to use all building/pushing image targets -IMG ?= controller:latest +DEFAULT_IMG ?= quay.io/openstack-k8s-operators/osp-director-operator:latest +IMG ?= $(DEFAULT_IMG) # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.25.0 # Metrics bind address From be6eb59ecb74a47d84f27effa31c54d2faf8944b Mon Sep 17 00:00:00 2001 From: Jon Schlueter Date: Wed, 24 May 2023 09:33:23 -0400 Subject: [PATCH 2/2] Add OPERATOR_SDK pattern to makefile - default to LOCALBIN operator-sdk - add operator-sdk pinning to make sure we keep same version Change-Id: Ic499ac3feddee132822d1a55c90c5ba4a75e0249 --- Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 867df54f..13472f07 100644 --- a/Makefile +++ b/Makefile @@ -226,10 +226,12 @@ $(LOCALBIN): KUSTOMIZE ?= $(LOCALBIN)/kustomize CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest +OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 CONTROLLER_TOOLS_VERSION ?= v0.10.0 +OPERATOR_SDK_VERSION ?= v1.19.0 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize @@ -247,13 +249,18 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. $(ENVTEST): $(LOCALBIN) test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest +.PHONY: operator-sdk +operator-sdk: $(OPERATOR_SDK) +$(OPERATOR_SDK): $(LOCALBIN) + test -s $(OPERATOR_SDK) || curl -o $(LOCALBIN)/operator-sdk -L https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_linux_amd64 && chmod +x $(LOCALBIN)/operator-sdk + .PHONY: bundle -bundle: manifests kustomize ## Generate bundle manifests and metadata, then validate generated files. +bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metadata, then validate generated files. cp -f config/default/manager_default_images_${OSP_RELEASE}.yaml config/default/manager_default_images.yaml - operator-sdk generate kustomize manifests -q + $(OPERATOR_SDK) generate kustomize manifests -q cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG) - $(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS) - operator-sdk bundle validate ./bundle + $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS) + $(OPERATOR_SDK) bundle validate ./bundle rm -f config/default/manager_default_images.yaml .PHONY: bundle-build