Skip to content
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

✨ WIP Improved error handling around installedBundle and reconcile modularization #1030

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

bentito
Copy link
Contributor

@bentito bentito commented Jul 10, 2024

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 Improve Error Handling in InstalledBundle Determination and Logic #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:
    ✨ Cleaner Condition Types & Reasons #1007

  • vs. 1007 this PR also merged a slightly updated reconciler() from main around preflight implementation, so we should check logic still as intended


  1. 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.

  1. 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.
  1. 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.
  1. 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)

bentito added 14 commits July 2, 2024 06:20
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Signed-off-by: Brett Tofel <btofel@redhat.com>
Preserve installedBundle on error, report partial progress, use "Progressing" status.
Modularize into helper functions.
Use Helm secret as source of truth for installed bundle.
Update status at each step, clear "Progressing" on success/match.

Signed-off-by: Brett Tofel <btofel@redhat.com>
@bentito bentito added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
@bentito bentito requested a review from a team as a code owner July 10, 2024 14:54
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
Copy link

netlify bot commented Jul 10, 2024

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 0469c53
🔍 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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bentito bentito added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
Signed-off-by: Brett Tofel <btofel@redhat.com>
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2024
@openshift-merge-robot
Copy link

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.

@tmshort
Copy link
Contributor

tmshort commented Jul 26, 2024

@bentito are you going to rebase this?

@bentito
Copy link
Contributor Author

bentito commented Jul 26, 2024

@bentito are you going to rebase this?

I'm waiting to see about Bryce's refactoring from last week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants