-
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
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]>
recharte
approved these changes
Jan 10, 2025
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 👏
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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