operator-framework / operator-controller

A new and improved management framework for extending Kubernetes with Operators
https://operator-framework.github.io/operator-controller/
Apache License 2.0
61 stars 53 forks source link

Improve Error Handling in InstalledBundle Determination and Logic #1027

Open bentito opened 3 months ago

bentito commented 3 months ago

Improve Error Handling in InstalledBundle Determination and Logic

Summary

Current error handling in the InstalledBundle determination follows a simplistic approach of zeroing out state and returning an error. This issue aims to develop a more nuanced error handling strategy that preserves as much state as possible, continues progress where feasible, and maintains context of installed bundles even when encountering errors in catalog connections.

Details

Context

During the reconciliation process, the current error handling approach involves zeroing out state and returning an error, which can lead to loss of important context about the installed bundles. This is not ideal, especially when partial progress can still be reported, and previous state can be preserved. Discussions have highlighted the following key points:

Problem

  1. Loss of Installed Bundle Context: When errors occur, especially in catalog connections, the currently installed bundle is removed from the status, despite it still being installed.
  2. Early Error Termination: The current reconciliation logic stops at the first encountered error, missing out on capturing and preserving partial state.

Goals

  1. Preserve State: Implement error handling that retains the context of the installed bundle even in error scenarios.
  2. Report Partial Progress: Ensure the system continues to report as much progress as possible even when encountering errors.

Action Items

  1. Refactor Error Handling:

    • Develop a strategy to preserve the previous state when an error occurs, particularly focusing on maintaining the context of the installed bundle.
    • Ensure that partial progress is reported wherever feasible.
  2. Separate Installed Bundle Determination:

    • Isolate the logic for determining the installed bundle from the rest of the reconciliation process to simplify error handling and improve clarity.
    • Use the Helm secret as the source of truth for the installed bundle status.

References

Additional Notes

This issue is not being resolved in the PR #1007. However, it is crucial to address these improvements in the near future to enhance the reconciliation process.