-
Notifications
You must be signed in to change notification settings - Fork 2
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
EVEREST-1811 | dynamically configure watches for controllers #630
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
Signed-off-by: Mayank Shah <[email protected]>
|
||
utilruntime.Must(pgv2.SchemeBuilder.AddToScheme(scheme)) | ||
utilruntime.Must(psmdbv1.SchemeBuilder.AddToScheme(scheme)) | ||
utilruntime.Must(pxcv1.SchemeBuilder.AddToScheme(scheme)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it work if initially any of the operators have not been installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the scheme only holds a mapping between the APIs/GVK and the Go structs to facilitate encoding/decoding responses from the Kube API server. It does not talk to Kubernetes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so much more elegant than killing the pod 🙈 congratulations 👏
CHANGE DESCRIPTION
Problem:
EVEREST-1811
Everest operator sometimes does not restart when new DBEngines and CRDs are installed. Due to this, the newly added APIs are not registered to scheme, the watches not configured, and the operator is indefinitely stuck in an error state.
Cause:
With the addition of Helm installation, we made it possible to install the core components and DBNamespaces separately. One issue this brought was that the Everest operator now needed to restart so that the newly added CRDs are registered to the client scheme, and the watchers can be configured during bootstrap. So we added some mechanism to detect if a new DBEngine is installed, and restart the pod.
But this mechanism fails sometimes if there are delays in the CRD creation, which can lead to a race condition. For example, if some CRDs are created late, the operator will restart regardless, and can fail to observe those CRDs. As a result, the watchers are only partially configured. Moreover, the restart logic checks only the GroupVersion in the scheme and assumes that all Kinds are registered.
Solution:
This PR removes the need to restart the Everest operator by dynamically registering watchers based on the installed DBEngines:
Controller
interface exposed bycontroller-runtime
to add watchers (to other controllers) during DBEngine reconciliationReconcileWatchers
function that updates its watchers based on the DBEngines. ThisReconcileWatchers
is called during theDBEngine
reconciliationWith such a mechanism, the various watchers are constantly being reconciled by the DBEngine controller. Such an approach requires no restart since the watchers are configured dynamically during runtime, and also makes no assumptions based on the scheme's registered groups (rather it ensures that the correct watchers are configured)
tl;dr - DBEngines reconciler reconciles the watchers on other reconcilers
CHECKLIST
Helm chart
Jira
Tests