From 95db9afac12882dfd45b5caf413780995e591872 Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Fri, 15 Nov 2024 17:46:35 +0530 Subject: [PATCH] Add watcher target to deploy operator via olm This pr adds two targets: * `make watcher`: It generates olm.yaml file and installs the watcher-operator using oc. * `make watcher_cleanup`: It generates the olm.yaml file and undeploy the watcher-operator using oc. * `make watcher_deploy`: To deploy the watcher service * `make watcher_deploy_cleanup`: To undeploy the watcher service It also provides $CATALOG_IMAGE var to pass custom watcher-operator index image. Jira: https://issues.redhat.com/browse/OSPRH-11419 Signed-off-by: Chandan Kumar --- .gitignore | 3 +++ Makefile | 23 +++++++++++++++++++++++ README.md | 36 ++++++++++++++++++++++++++++++++++++ ci/olm.sh | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 ci/olm.sh diff --git a/.gitignore b/.gitignore index 4740b5b..955f948 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ CI_TOOLS_REPO *.swp *.swo *~ + +# CI generated files +ci/olm.yaml diff --git a/Makefile b/Makefile index b59d8bd..77fc0a2 100644 --- a/Makefile +++ b/Makefile @@ -371,3 +371,26 @@ update-watcher-csv: if [ "$(has_webhooks)" != "null" ]; then \ oc patch -n $(OPERATOR_NAMESPACE) $(csv) --type json -p='[{"op": "remove", "path": "/spec/webhookdefinitions"}]'; \ fi + +CATALOG_IMAGE ?= quay.io/openstack-k8s-operators/watcher-operator-index:latest + +.PHONY: watcher +watcher: export CATALOG_IMG=${CATALOG_IMAGE} +watcher: ## Install watcher operator via olm + bash ci/olm.sh + oc apply -f ci/olm.yaml + timeout 300s bash -c "while ! (oc get csv -n openstack-operators -l operators.coreos.com/watcher-operator.openstack-operators -o jsonpath='{.items[*].status.phase}' | grep Succeeded); do sleep 1; done" + +.PHONY: watcher_deploy +watcher_deploy: ## Deploy watcher service + oc apply -f config/samples/watcher_v1beta1_watcher.yaml + +.PHONY: watcher_deploy_cleanup +watcher_deploy_cleanup: ## Undeploy watcher service + oc delete -f config/samples/watcher_v1beta1_watcher.yaml + +.PHONY: watcher_cleanup +watcher_cleanup: export CATALOG_IMG=${CATALOG_IMAGE} +watcher_cleanup: ## Cleaning watcher operator via olm + bash ci/olm.sh + oc delete -f ci/olm.yaml diff --git a/README.md b/README.md index 3e9773d..75d9a06 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,42 @@ make uninstall make undeploy ``` +### To Deploy via OLM + +**Deploy watcher-operator via olm + +```sh +make watcher +``` + +**Deply watcher-operator via olm with different catalog image + +```sh +make watcher CATALOG_IMAGE= +``` + +#### To Deploy watcher service + +**Deploy watcher service + +```sh +make watcher_deploy +``` + +### To Uninstall OLM deployed watcher-operator + +**Undeploy watcher service + +```sh +make watcher_deploy_cleanup +``` + +**Uninstall watcher-operator + +```sh +make watcher_cleanup +``` + ## Project Distribution Following are the steps to build the installer and distribute this project to users. diff --git a/ci/olm.sh b/ci/olm.sh new file mode 100644 index 0000000..2c71c2e --- /dev/null +++ b/ci/olm.sh @@ -0,0 +1,36 @@ +cat > ci/olm.yaml <