Skip to content

Commit

Permalink
Create Namespace if not exist
Browse files Browse the repository at this point in the history
Now that we use our own namespace, it might not exist already when
running `bundle-run` Makefile target.

Add a new Makefile target to create the Namespace, if it does not exist,
before running `bundle-run`

Signed-off-by: Carlo Lobrano <[email protected]>
  • Loading branch information
clobrano committed Feb 14, 2024
1 parent 80ca200 commit 85bcc71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,17 @@ test: envtest manifests generate fmt vet ## Run tests.

.PHONY: bundle-run
export BUNDLE_RUN_NAMESPACE ?= openshift-workload-availability
bundle-run: operator-sdk ## Run bundle image. Default NS is "openshift-workload-availability", redefine BUNDLE_RUN_NAMESPACE to override it.
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-cleanup
bundle-cleanup: operator-sdk ## Remove bundle installed via bundle-run
$(OPERATOR_SDK) -n $(BUNDLE_RUN_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)

##@ Build

.PHONY: build
Expand Down

0 comments on commit 85bcc71

Please sign in to comment.