From 03353349ad599288b1ea491abf4db289f48d0836 Mon Sep 17 00:00:00 2001 From: oraz Date: Mon, 27 May 2024 16:44:28 +0300 Subject: [PATCH 1/2] Update bundle image Run 'VERSION=SOME_VERSION' prior to running the bundle-run or bundle-run-update targets to modify the installed or replaced bundle CSV --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 1ed46a29..e11cbf9e 100644 --- a/Makefile +++ b/Makefile @@ -191,6 +191,12 @@ export BUNDLE_RUN_NAMESPACE ?= openshift-workload-availability bundle-run: operator-sdk create-ns ## Run bundle image. Default NS is "openshift-workload-availability", redefine BUNDLE_RUN_NAMESPACE to override it. $(OPERATOR_SDK) -n $(BUNDLE_RUN_NAMESPACE) run bundle $(BUNDLE_IMG) +.PHONY: bundle-run-update +bundle-run-update: operator-sdk ## Update bundle image. +# An older bundle image CSV should exist in the cluster, and in the same namespace, +# Default NS is "openshift-workload-availability", redefine OPERATOR_NAMESPACE to override it. + $(OPERATOR_SDK) -n $(OPERATOR_NAMESPACE) run bundle-upgrade $(BUNDLE_IMG) + .PHONY: bundle-cleanup bundle-cleanup: operator-sdk ## Remove bundle installed via bundle-run $(OPERATOR_SDK) -n $(BUNDLE_RUN_NAMESPACE) cleanup $(OPERATOR_NAME) From 4689318f2218803aad755f98bedf89d3707d9107 Mon Sep 17 00:00:00 2001 From: oraz Date: Mon, 27 May 2024 16:45:58 +0300 Subject: [PATCH 2/2] Change var name BUNDLE_RUN_NAMESPACE to OPERATOR_NAMESPACE OPERATOR_NAMESPACE is widely used in other Medik8s operators --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e11cbf9e..4beaf98a 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ ENVSUBST_VERSION = v1.4.2 OCP_VERSION = 4.12 OPERATOR_NAME ?= self-node-remediation +OPERATOR_NAMESPACE ?= openshift-workload-availability # VERSION defines the project version for the bundle. # Update this value when you upgrade the version of your project. @@ -187,9 +188,8 @@ test: envtest manifests generate fmt vet ## Run tests. go test ./api/... ./controllers/... ./pkg/... -coverprofile cover.out -v ${TEST_OPS} .PHONY: bundle-run -export BUNDLE_RUN_NAMESPACE ?= openshift-workload-availability -bundle-run: operator-sdk create-ns ## Run bundle image. Default NS is "openshift-workload-availability", redefine BUNDLE_RUN_NAMESPACE to override it. - $(OPERATOR_SDK) -n $(BUNDLE_RUN_NAMESPACE) run bundle $(BUNDLE_IMG) +bundle-run: operator-sdk create-ns ## Run bundle image. Default NS is "openshift-workload-availability", redefine OPERATOR_NAMESPACE to override it. + $(OPERATOR_SDK) -n $(OPERATOR_NAMESPACE) run bundle $(BUNDLE_IMG) .PHONY: bundle-run-update bundle-run-update: operator-sdk ## Update bundle image. @@ -199,11 +199,11 @@ bundle-run-update: operator-sdk ## Update bundle image. .PHONY: bundle-cleanup bundle-cleanup: operator-sdk ## Remove bundle installed via bundle-run - $(OPERATOR_SDK) -n $(BUNDLE_RUN_NAMESPACE) cleanup $(OPERATOR_NAME) + $(OPERATOR_SDK) -n $(OPERATOR_NAMESPACE) cleanup $(OPERATOR_NAME) .PHONY: create-ns create-ns: ## Create namespace - $(KUBECTL) get ns $(BUNDLE_RUN_NAMESPACE) 2>&1> /dev/null || $(KUBECTL) create ns $(BUNDLE_RUN_NAMESPACE) + $(KUBECTL) get ns $(OPERATOR_NAMESPACE) 2>&1> /dev/null || $(KUBECTL) create ns $(OPERATOR_NAMESPACE) ##@ Build