The below guidelines will explain how to build and install the operator on a remote cluster.
- go version v1.25+
- operator SDK v1.9.0+ (Note: This version may need updating for current OCP versions)
- opm v1.15.1+
- yq
- docker or podman
- quay credentials
- Add your valid quay pull-secret.yaml file in
hack/prereqs/pull-secret.yaml
export DOCKER_USER=<DOCKER_USER>
export DOCKER_PASS=<DOCKER_PASS>It is also recommended to set a unique version label
export VERSION=<A_UNIQUE_VERSION>There are 3 ways to install the operator:
make -f Makefile.dev prereqs subscriptions
make manifests generate
make docker-build docker-push deploy
OR
make -f Makefile.dev full-dev-installThis will
- Apply necessary prereqs. (Namespace, operatorgroup)
- Update manifests via kubebuilder
- Applies community operator subscriptions for dependencies
- Builds and pushes MCH Operator dev image
- Deploys operator via kustomize from
config/manager
Note: For podman users, use make -f Makefile.dev podman-full-dev-install instead.
This method is preferred during development cycle to deploy and test faster. LeaderElectionNamespace line in main.go must be uncommented. POD_NAMESPACE must be set.
make runThis will
- Run the go application from main.go directly against targetting cluster
OLM will manage creation of most resources required to run the operator. This method builds and pushes an actual index image.
make manifests generate bundle bundle-build bundle-push catalog-build catalog-push
make -f Makefile.dev prereqs subscriptions catalog
OR
make -f Makefile.dev full-catalog-installThis will
- Update manifests via kubebuilder
- Bundle the operator
- Build and push the bundle image
- Build and push the catalog image
- Apply prereqs (Namespace, operatorgroup)
- Applies community operator subscriptions for dependencies
- Deploys Operator by deploying Catalogsource and subscription
Note: For podman users, use podman-bundle-build, podman-bundle-push instead of the docker equivalents.
Once the operator is installed in the cluster, initiate an installation by creating an instance of MultiClusterHub. To create a default instance of MultiClusterHub:
make -f Makefile.dev crTo customize the instance, first modify the spec in
config/samples/operator_v1_multiclusterhub.yaml.
Delete multiclusterhub instance if it exists
kubectl delete mch --allClean up the operator and its resources:
make undeployIf not all resources are properly cleaned up, follow the uninstall instructions at https://github.com/stolostron/deploy to manually clean up remaining resources.