The below guidelines will explain how to build and install the operator on a remote cluster.
- go version v1.17+
- operator SDK v1.9.0+
- opm v1.12.5+
- yq
- docker
- 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 prereqs manifests update-manifest update-crds subscriptions docker-build docker-push deploy
OR
make full-dev-install
This will
- Apply necessary prereqs. (Namespace, operatorgroup)
- Update manifests via kubebuilder
- Updates CRDs and retrieves latest image manifests
- Applies community operator subscriptions for Hive, AppSub, and ClusterManager
- Builds and pushes MCH Operator dev image
- Deploys operator via kustomize from
config/manager
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 run
This 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 prereqs subscriptions catalog
OR
make full-catalog-install
This 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 Hive, AppSub, and ClusterManager
- Deploys Operator by deploying Catalogsource and subscription
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 cr
To customize the instance, first modify the spec in
config/samples/operator_v1_multiclusterhub.yaml
.
Delete multiclusterhub instance if it exists
kubectl delete mch --all
Clean up the operator and its resources:
make undeploy
If not all resources are properly cleaned up, follow the uninstall instructions at https://github.com/stolostron/deploy to manually clean up remaining resources.