Follow the same steps described in Setup and manual Deployment up to the step 'Deploy Operator'.
cd operator-application
source ../versions.env
make bundle IMG="$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR"
podman build -f bundle.Dockerfile -t "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_BUNDLE" .
podman push "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_BUNDLE"
There are two ways to deploy the operator:
operator-sdk run bundle "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_BUNDLE" -n operators
- Example output:
...
Note: In case you have problem use following commands to clean the installation.
operator-sdk cleanup operator-application -n operators --delete-all
Find the installplans
kubectl get installplans -n operators | grep operator-application
Delete the installplans
kubectl delete installplan install-76xlj -n operators
- Create a namespace for the
Database Operator
kubectl create namespace database
- Create the
Custom Resource Definition
for theDatabase Operator
kubectl apply -f ../operator-database/config/crd/bases/database.sample.third.party_databases.yaml
Build and push the catalog image:
$ ./bin/opm index add --build-tool podman --mode semver --tag "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_CATALOG" --bundles "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_BUNDLE"
$ podman push "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_CATALOG"
Define "$REGISTRY/$ORG/$IMAGE_APPLICATION_OPERATOR_CATALOG" in olm/catalogsource.yaml and invoke these commands.
$ kubectl apply -f olm/catalogsource.yaml
$ kubectl apply -f olm/subscription.yaml
$ kubectl get installplans -n operators
If the install plan requires manual approval, use this command:
$ kubectl -n operators patch installplan install-xxxxx -p '{"spec":{"approved":true}}' --type merge
In both cases the setup can be verified via these commands:
$ kubectl get all -n operators
$ kubectl get catalogsource operator-application-catalog -n operators -oyaml
$ kubectl get subscriptions operator-application-v0-0-1-sub -n operators -oyaml
$ kubectl get csv operator-application.v0.0.1 -n operators -oyaml
$ kubectl get installplans -n operators
$ kubectl get installplans install-xxxxx -n operators -oyaml
$ kubectl get operators operator-application.operators -n operators -oyaml
In both cases an application resource can be created via this command:
$ kubectl apply -f config/samples/application.sample_v1beta1_application.yaml
$ kubectl get applications.application.sample.ibm.com/application -n application-beta -oyaml
$ kubectl exec -n application-beta $(kubectl get pods -n application-beta | awk '/application-deployment-microservice/ {print $1;exit}') --container application-microservice -- curl http://localhost:8081/hello
$ kubectl logs -n operators $(kubectl get pods -n operators | awk '/operator-application-controller-manager/ {print $1;exit}') -c manager
1. Delete all resources (operator-sdk):
$ kubectl delete -f config/samples/application.sample_v1beta1_application.yaml
$ operator-sdk cleanup operator-application -n operators --delete-all
$ kubectl apply -f ../operator-database/config/crd/bases/database.sample.third.party_databases.yaml
$ operator-sdk olm uninstall
2. Delete all resources (kubectl):
$ kubectl delete -f config/samples/application.sample_v1beta1_application.yaml
$ kubectl delete -f olm/subscription.yaml
$ kubectl delete -f olm/catalogsource.yaml
$ operator-sdk olm uninstall