Skip to content

Commit

Permalink
Add watcher target to deploy operator via olm
Browse files Browse the repository at this point in the history
Since watcher-operator is going to standalone operator to be released
via FR2. In order to install it via olm, This pr adds make target in
the watcher-operator repo to achieve the same.

Jira: https://issues.redhat.com/browse/OSPRH-11419

Signed-off-by: Chandan Kumar <[email protected]>
  • Loading branch information
raukadah committed Nov 18, 2024
1 parent 953b0a8 commit fb0c44e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ endif
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

# Catalog Image
CATALOG_IMG ?= quay.io/openstack-k8s-operators/watcher-operator-index:latest

GOTOOLCHAIN_VERSION ?= go1.21.0

.PHONY: all
Expand Down Expand Up @@ -371,3 +374,14 @@ update-watcher-csv:
if [ "$(has_webhooks)" != "null" ]; then \
oc patch -n $(OPERATOR_NAMESPACE) $(csv) --type json -p='[{"op": "remove", "path": "/spec/webhookdefinitions"}]'; \
fi

.PHONY: watcher
watcher: ## Deploying watcher operator via olm
cd ci/olm-deploy && $(KUSTOMIZE) edit set image catalog-image=${CATALOG-IMG}
$(KUSTOMIZE) build ci/olm-deploy | kubectl create -f -
$(eval csvname=$(shell oc get csv -n openstack-operators -o jsonpath='{range .items[*]}{@.metadata.name}{"\n"}{end}' | grep -E "^watcher-operator\.v"))
timeout 30 bash -c 'until [ "$(shell oc get -n openstack-operators csv/$(csvname) -o jsonpath='{.status.phase}')" == "Succeeded" ]; do sleep 5; done'

.PHONY: watcher_cleanup
watcher_cleanup: ## Cleaning watcher operator via olm
$(KUSTOMIZE) build ci/olm-deploy | kubectl delete -f -
9 changes: 9 additions & 0 deletions ci/olm-deploy/catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: watcher-operator-index
namespace: openstack-operators
spec:
image: quay.io/openstack-k8s-operators/watcher-operator-index:latest
sourceType: grpc
17 changes: 17 additions & 0 deletions ci/olm-deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- catalogsource.yaml

patches:
- patch: |-
- op: replace
path: /spec/image
value:
name: catalog-image
value: quay.io/openstack-k8s-operators/watcher-operator-index:latest
target:
kind: CatalogSource
name: watcher-operator-index
8 changes: 8 additions & 0 deletions ci/olm-deploy/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: openstack-operators
labels:
pod-security.kubernetes.io/enforce: privileged
security.openshift.io/scc.podSecurityLabelSync: "false"
6 changes: 6 additions & 0 deletions ci/olm-deploy/operatorgroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openstack
namespace: openstack-operators
11 changes: 11 additions & 0 deletions ci/olm-deploy/subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: watcher-operator
namespace: openstack-operators
spec:
name: watcher-operator
channel: alpha
source: watcher-operator-index
sourceNamespace: openstack-operators

0 comments on commit fb0c44e

Please sign in to comment.