Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watcher target to deploy operator via olm #8

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ CI_TOOLS_REPO
*.swp
*.swo
*~

# CI generated files
ci/olm.yaml
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<catalog image url with tag>
```

#### 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.
Expand Down
36 changes: 36 additions & 0 deletions ci/olm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cat > ci/olm.yaml <<EOF_CAT
---
apiVersion: v1
kind: Namespace
metadata:
name: openstack-operators
labels:
pod-security.kubernetes.io/enforce: privileged
security.openshift.io/scc.podSecurityLabelSync: "false"
---
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: watcher-operator-index
namespace: openstack-operators
spec:
image: ${CATALOG_IMG}
sourceType: grpc
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openstack
namespace: openstack-operators
---
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
EOF_CAT