operator-controller
operator-controller copied to clipboard
✨ WIP Improved error handling around installedBundle and reconcile modularization
Description
WIP, because:
-
I'd like feedback on whether the reconciler() loop modularization seems good and whether the proposed logic flow changes match up with https://github.com/operator-framework/operator-controller/issues/1027 , which is restated below.
-
Unit tests are still broken. Just looking for feedback on overall approach.
-
This branch/PR cherry picks all the new commits (as of now) from branch/PR: https://github.com/operator-framework/operator-controller/pull/1007
-
vs. 1007 this PR also merged a slightly updated reconciler() from main around preflight implementation, so we should check logic still as intended
- Improved Error Handling
-
State Preservation: The installedBundle information is fetched early on and preserved throughout the reconciliation process. Even if errors occur later, the status accurately reflects the previously installed bundle.
-
Partial Progress Reporting: Each step has its own error handling and status update logic. If an error occurs in one step, the status is updated accordingly (e.g., setResolvedStatusConditionFailed, setInstalledStatusConditionFailed), but the reconciliation process continues where possible. This ensures that partial progress is reported.
-
Progressing Status: The setInstalledStatusConditionProgressing function is used to indicate when a new version is resolved but not yet installed. The clearInstalledStatusConditionProgressing function is called when the installation is complete or if the resolved and installed bundles match.
- Modularization
- Helper Functions: The reconcile function is broken down into smaller, self-contained helper functions (handleFinalization, resolveBundle, validateAndCheckDeprecation, unpackBundle, runPreflightChecks, installOrUpgrade, and watchDynamicResources). Each function handles a specific task, making the code more organized, readable, and testable.
- Helm Secret as Source of Truth
- GetInstalledBundle: The InstalledBundleGetter.GetInstalledBundle function is used to retrieve the installed bundle information directly from the Helm secret, ensuring that the status accurately reflects the actual installed bundle.
- Comprehensive Status Updates
-
Status Updates at Each Step: Throughout the reconcile function and its helpers, status conditions are updated to reflect the progress and outcome of each step. This provides detailed information about the reconciliation process, even if errors occur.
-
Progressing Status: The TypeProgressing condition is used to clearly indicate when an installation or upgrade is in progress.
Reviewer Checklist
- [ ] API Go Documentation
- [ ] Tests: Unit Tests (and E2E Tests, if appropriate)
- [ ] Comprehensive Commit Messages
- [ ] Links to related GitHub Issue(s)
Deploy Preview for olmv1 ready!
| Name | Link |
|---|---|
| Latest commit | 0469c53620925e8faf21a912dd499174cb7c319e |
| Latest deploy log | https://app.netlify.com/sites/olmv1/deploys/668ea3a86f0d370008b11e66 |
| Deploy Preview | https://deploy-preview-1030--olmv1.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
PR needs rebase.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
@bentito are you going to rebase this?
@bentito are you going to rebase this?
I'm waiting to see about Bryce's refactoring from last week
closing this as stale - please re-open if we still want to get this down =D