Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Nov 1, 2025

Resolves the TODO in SetDeprecationStatus that requested:

  1. Deprecation status should reflect the installed bundle, not the resolved bundle
  2. Show deprecation warnings even when resolution fails

This fix also addresses the scenario where a bundle resolves correctly but
fails to install: package/channel deprecations are populated correctly while
bundle deprecation stays Unknown/Absent because no bundle is installed yet.

Problem

Before this fix:

  • When catalog was removed/unreachable, conditions showed False (claiming "not deprecated")
  • During upgrades v1→v2, BundleDeprecated showed v2 status before v2 was installed
  • Install/validation errors leaked into deprecation conditions
  • Resolution failures couldn't show deprecation warnings

Solution

Defer deprecation status updates until reconciliation completes, using a
closure that reads the installed bundle name and catalog data. This ensures:

  1. Correct bundle reference: BundleDeprecated reflects installed bundle, not resolved
  2. Catalog absence handling: Unknown when catalog unavailable (not False)
  3. Error separation: Install errors stay in Progressing, never in deprecation conditions
  4. Warnings on failure: Deprecation data shown even when resolution fails

Scenarios Handled

Scenario PackageDeprecated ChannelDeprecated BundleDeprecated Notes
No catalog + no bundle Unknown/Deprecated Unknown/Deprecated Unknown/Absent Catalog unavailable
No catalog + bundle installed Unknown/Deprecated Unknown/Deprecated Unknown/Deprecated Bundle exists but catalog absent
Resolution succeeds, install fails From catalog From catalog Unknown/Absent No bundle installed yet
During upgrade v1→v2 From catalog From catalog Shows v1 status Not v2 (not installed)
Resolution fails with warnings True if deprecated True if deprecated Unknown/Absent Warnings reach users
Resolution fails, no catalog Unknown Unknown Unknown Catalog completely absent

Resolver Contract

The fix relies on the resolver to signal catalog availability:

  • Returns deprecation != nil when catalog is available (even if resolution fails)
  • Returns deprecation = nil when catalog is unavailable
  • This allows the controller to distinguish "catalog says not deprecated" from "catalog absent"

Example scenarios fixed

1. Catalog Removed - Was Showing False (WRONG)

Before the fix:

# Bundle v1.0.0 installed, then catalog removed
status:
  conditions:
    - type: Deprecated
      status: "False"           # ❌ WRONG - claims "not deprecated"
      reason: Deprecated
      message: ""
      
    - type: PackageDeprecated
      status: "False"           # ❌ WRONG - no catalog to check!
      reason: Deprecated
      
    - type: BundleDeprecated
      status: "False"           # ❌ WRONG
      reason: Absent            # ❌ WRONG - bundle exists!

After the fix:

# Bundle v1.0.0 installed, then catalog removed
status:
  conditions:
    - type: Deprecated
      status: "Unknown"         # ✅ CORRECT - we don't know
      reason: Deprecated
      message: ""
      
    - type: PackageDeprecated
      status: "Unknown"         # ✅ CORRECT - catalog unavailable
      reason: Deprecated
      
    - type: BundleDeprecated
      status: "Unknown"         # ✅ CORRECT - catalog unavailable
      reason: Deprecated        # ✅ CORRECT - bundle exists

2. During Upgrade - Was Showing New Bundle (WRONG)

Before the fix:

# Installed: v1.0.0, Upgrading to: v1.0.1 (not installed yet)
status:
  install:
    bundle:
      name: "operator.v1.0.0"  # v1.0.0 still installed
  conditions:
    - type: BundleDeprecated
      status: "True"
      reason: Deprecated
      message: "Bundle v1.0.1 is deprecated"  # ❌ WRONG - showing v1.0.1!

After the fix:

# Installed: v1.0.0, Upgrading to: v1.0.1 (not installed yet)
status:
  install:
    bundle:
      name: "operator.v1.0.0"  # v1.0.0 still installed
  conditions:
    - type: BundleDeprecated
      status: "False"
      reason: Deprecated
      message: ""  # ✅ CORRECT - shows v1.0.0 status (not deprecated)

3. Resolution Fails But Has Warnings - Warnings Lost

Before the fix:

# Resolution fails: package "foo" not found (but package IS deprecated in catalog)
status:
  conditions:
    - type: Progressing
      status: "True"
      reason: Retrying
      message: "no package 'foo' found"
      
    - type: PackageDeprecated
      status: "False"           # ❌ WRONG - warning lost!
      reason: Deprecated
      message: ""

After the fix:

# Resolution fails: package "foo" not found (but package IS deprecated in catalog)
status:
  conditions:
    - type: Progressing
      status: "True"
      reason: Retrying
      message: "no package 'foo' found"
      
    - type: PackageDeprecated
      status: "True"            # ✅ CORRECT - warning shown!
      reason: Deprecated
      message: "Package foo is deprecated, migrate to bar"  # ✅ User sees warning!

4. Resolution Succeeds, Install Fails - Bundle Status Wrong

Before the fix:

# Resolution succeeds (prometheus.v1.0.0), but apply fails
status:
  install: {}  # Nothing installed
  conditions:
    - type: Progressing
      status: "True"
      reason: Retrying
      message: "apply failed: deployment conflict"
      
    - type: PackageDeprecated
      status: "False"           # ✅ Correct
      
    - type: BundleDeprecated
      status: "True"            # ❌ WRONG - nothing installed yet!
      reason: Deprecated
      message: "Bundle deprecated"

After the fix:

# Resolution succeeds (prometheus.v1.0.0), but apply fails
status:
  install: {}  # Nothing installed
  conditions:
    - type: Progressing
      status: "True"
      reason: Retrying
      message: "apply failed: deployment conflict"
      
    - type: PackageDeprecated
      status: "False"           # ✅ Correct
      
    - type: BundleDeprecated
      status: "Unknown"         # ✅ CORRECT - nothing installed yet
      reason: Absent            # ✅ CORRECT
      message: ""

5. Boxcutter RollingOut - Was Showing False (WRONG)

Before the fix:

# Boxcutter has RollingOut revision, apply fails
# No resolver call happens (reusing revision)
status:
  conditions:
    - type: Deprecated
      status: "False"           # ❌ WRONG - no catalog lookup!
      
    - type: PackageDeprecated
      status: "False"           # ❌ WRONG
      
    - type: BundleDeprecated
      status: "Unknown"
      reason: Absent

After the fix:

# Boxcutter has RollingOut revision, apply fails
# No resolver call happens (reusing revision)
status:
  conditions:
    - type: Deprecated
      status: "Unknown"         # ✅ CORRECT - no catalog data
      
    - type: PackageDeprecated
      status: "Unknown"         # ✅ CORRECT
      
    - type: BundleDeprecated
      status: "Unknown"         # ✅ CORRECT
      reason: Absent

Motivation

Closes: #2008

Copilot AI review requested due to automatic review settings November 1, 2025 07:58
@camilamacedo86 camilamacedo86 requested a review from a team as a code owner November 1, 2025 07:58
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 1, 2025
@openshift-ci openshift-ci bot requested a review from dtfranz November 1, 2025 07:58
@netlify
Copy link

netlify bot commented Nov 1, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit baf566c
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/690e4598e077450008bb97b1
😎 Deploy Preview https://deploy-preview-2296--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 project configuration.

@openshift-ci openshift-ci bot requested a review from oceanc80 November 1, 2025 07:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors deprecation status handling in ClusterExtension reconciliation to ensure deprecation conditions accurately reflect catalog data and installed bundle state, preventing install/validation errors from leaking into deprecation conditions.

  • Moved deprecation status updates to a deferred function that runs at the end of reconciliation
  • Changed BundleDeprecated condition to use Unknown status with ReasonAbsent when no bundle is installed
  • Updated test expectations to handle multiple possible error messages for sourceType validation

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/operator-controller/controllers/clusterextension_controller.go Refactored deprecation status logic with deferred updates and new condition semantics for uninstalled bundles
internal/operator-controller/controllers/clusterextension_controller_test.go Added tests for deprecation handling with resolution failures and applier failures; updated test expectations for BundleDeprecated conditions
test/e2e/cluster_extension_install_test.go Updated e2e tests to verify deprecation conditions in success and failure scenarios
internal/operator-controller/controllers/clusterextension_admission_test.go Enhanced sourceType validation test to handle multiple possible error message formats

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings November 1, 2025 08:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.32%. Comparing base (b3f85d5) to head (baf566c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2296      +/-   ##
==========================================
+ Coverage   71.14%   74.32%   +3.17%     
==========================================
  Files          91       91              
  Lines        7046     7076      +30     
==========================================
+ Hits         5013     5259     +246     
+ Misses       1618     1406     -212     
+ Partials      415      411       -4     
Flag Coverage Δ
e2e 46.13% <82.50%> (+0.19%) ⬆️
experimental-e2e 48.34% <82.50%> (?)
unit 58.73% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@camilamacedo86 camilamacedo86 changed the title WIP: 🐛 (fix):Fix deprecation conditions leaking install errors 🐛 (fix):Fix deprecation conditions leaking install errors Nov 1, 2025
@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 Nov 1, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

internal/operator-controller/controllers/clusterextension_controller_test.go:1

  • The assertion require.Contains(ct, []string{...}, cond.Reason) is semantically backwards. The Contains function expects a slice as the second argument and the search item as the first. This should be require.Contains(ct, cond.Reason, []string{ocv1.ReasonFailed, ocv1.ReasonAbsent}) or use require.True(ct, slices.Contains([]string{ocv1.ReasonFailed, ocv1.ReasonAbsent}, cond.Reason)).
package controllers_test

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camilamacedo86 camilamacedo86 changed the title WIP: 🐛 Fix deprecation conditions leaking install errors 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak Nov 7, 2025
@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 Nov 7, 2025
Copilot AI review requested due to automatic review settings November 7, 2025 16:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camilamacedo86 camilamacedo86 changed the title 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak WIP 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak Nov 7, 2025
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2025
@operator-framework operator-framework deleted a comment from Copilot AI Nov 7, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings November 7, 2025 17:41
@camilamacedo86 camilamacedo86 requested review from Copilot and removed request for Copilot November 7, 2025 17:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

internal/operator-controller/controllers/clusterextension_controller_test.go:1856

  • Corrected spelling of 'channedl' to 'channel'.
						Message: "another bad channedl!",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camilamacedo86 camilamacedo86 changed the title WIP 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak Nov 7, 2025
@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 Nov 7, 2025
@camilamacedo86 camilamacedo86 changed the title 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak WIP 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak Nov 7, 2025
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2025
@camilamacedo86 camilamacedo86 changed the title WIP 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak 🐛 report Unknown for deprecation status when catalog unavailable and prevent error leak Nov 7, 2025
@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 Nov 7, 2025
… and prevent error leak

When a catalog is removed or unreachable, deprecation conditions now correctly show Unknown instead of False. BundleDeprecated now reflects the installed bundle and uses the correct reason.

- Defer deprecation status updates until end of reconciliation
- Track hadCatalogDeprecationData to distinguish catalog absence from 'not deprecated'
- Report installed bundle deprecation, not the bundle being installed
- BundleDeprecated uses Deprecated reason when bundle exists, Absent only when none
- Prevent install/validation errors from leaking into deprecation conditions

Scenarios fixed:

- No catalog + no bundle → BundleDeprecated: Unknown/Absent
- No catalog + bundle installed → BundleDeprecated: Unknown/Deprecated (was False/Absent)
- During upgrade v1→v2 → shows v1 status, not v2
- Resolution fails with warnings → deprecation warnings still reach users

Assisted-by: Cursor
Copilot AI review requested due to automatic review settings November 7, 2025 19:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camilamacedo86
Copy link
Contributor Author

crd-diff / crd-diff (pull_request)F

That fails due change in the description to properly supplement it.
Not due breaking changes.
We should be able to ovewrite

/overwrite crd-diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install error message getting propagated to most conditions

4 participants