There are multiple controllers with in the project and the controller have dependency to specific kubernetes API resources.
When a required resource for the specific controller is not present the controller should not be started.
If the manadatory kubernete resource is not present, the operator will not start the corresponding controller that depended on the resource. The main() function of the operator have a monitor go routine for the kubernete API resources. Once the missing manadatory kubernete resource was installed, the operator will gracefully shutdown and kubernetes will restart the pod. Once the pod have restarted, the controller cluster deployment based on hive will be started.
- clusterdeployments.hive.openshift.io/v1
- cluster.open-cluster-management.io/v1
- certificates.k8s.io/v1beta1
The main controller package controller/controller
generated by operator-sdk was modified in order to implement this behavior.
In the future if we need to add a new controller modification need to be done to the controller/add_<controllername>.go
file generated by the operator-sdk. (for example refer to `add_clusterdeployment.go)