Skip to content

Conversation

@perdasilva
Copy link
Contributor

@perdasilva perdasilva commented Oct 22, 2025

Description

Currently, if a bundle only supports OwnNamespace the watchNamespace configuration will no be present for that bundle and the bundle will be automatically installed in OwnNamespace mode (by setting the targetNamespaces to the install namespace). While this is intuitive and makes life easier for the user, it can can lead to a break in default behavior if the package decided to add AllNamespaces support. For instance:

v1 only supports OwnNamespace install mode. The ClusterExtension has no configuration so the bundle is installed in OwnNamespace mode.

v1.1 adds AllNamespaces support and the ClusterExtension detects the upgrade and initiates it. The default is now AllNamespaces mode. So, the operator is now installed in AllNamespace mode without knowledge or acceptance by the user.

To address this issue, we modify the defaulting and configuration behavior for this case by requiring watchNamespace to be set and removing the defaulting behavior, i.e. making it undefined. I.e. only bundles with AllNamespaces mode can be installed without watchNamespace configuration. This means that when v2 comes out with AllNamespaces support, the configuration will already be present in the ClusterExtension and v2 will be installed in the same mode. The user can then remove the configuration if they wish to change install modes.

So, in this PR, we:

  • Add some additional unit tests around watchNamespaces being null/empty (this is not exactly related but was identified while writing this PR)
  • Modify the configuration validation to ensure that watchNamespaces is required when OwnNamespace is the only supported install mode (we include MultiNamespaces in the tests for completeness but this install mode will never be supported)
  • Modify the defaulting behavior in the reg+v1 renderer to ensure no defaults are set for bundles that don't support AllNamespaces install mode
  • Add ExtensionConfigBytes() method to ClusterExtension to easily grab user configuration
  • Update UnmarshalConfig to treat nil as {} to force schema validation (catch missing required values, etc.)
  • Update RegistryV1ManifestProvider tests to ensure bundle configuration is being properly validated
  • Add single-namespace- and own-namespace-operator fixtures and update e2e tests to check for bad configuration as well as good

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@perdasilva perdasilva requested a review from a team as a code owner October 22, 2025 20:02
@openshift-ci openshift-ci bot requested review from bentito and grokspawn October 22, 2025 20:02
@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit f995320
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/68fa7e750d7f9f0008072ff6
😎 Deploy Preview https://deploy-preview-2283--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.

@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.28%. Comparing base (3a6afed) to head (f995320).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2283      +/-   ##
==========================================
+ Coverage   71.19%   71.28%   +0.09%     
==========================================
  Files          90       90              
  Lines        6995     7003       +8     
==========================================
+ Hits         4980     4992      +12     
+ Misses       1601     1599       -2     
+ Partials      414      412       -2     
Flag Coverage Δ
e2e 45.88% <7.69%> (-0.03%) ⬇️
experimental-e2e 14.70% <0.00%> (+0.09%) ⬆️
unit 58.87% <100.00%> (+0.07%) ⬆️

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.

@perdasilva perdasilva force-pushed the own-namespace-config branch 5 times, most recently from c798c74 to 20fb0e2 Compare October 22, 2025 22:28
@perdasilva perdasilva changed the title 🐛 OwnNamespace default handling 🐛 OPRUN-4217: OwnNamespace default handling Oct 23, 2025
@perdasilva perdasilva requested a review from Copilot October 23, 2025 15:34
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 addresses an issue where bundles with only OwnNamespace support could automatically change install modes during upgrades when AllNamespaces support was added. The fix requires explicit watchNamespace configuration for bundles without AllNamespaces support, preventing unexpected mode changes during upgrades.

Key changes:

  • Modified configuration validation to require watchNamespace when AllNamespaces is not supported
  • Removed defaulting behavior for OwnNamespace-only bundles in the renderer
  • Enhanced test coverage for null/empty watchNamespace configurations

Reviewed Changes

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

Show a summary per file
File Description
internal/operator-controller/rukpak/bundle/config.go Updated validation logic to require watchNamespace for non-AllNamespaces bundles and changed nil config handling
internal/operator-controller/rukpak/render/render.go Removed automatic defaulting to install namespace for OwnNamespace-only bundles
internal/operator-controller/applier/provider.go Updated to use new ExtensionConfigBytes() method and apply validation for all SingleOwnNamespace cases
api/v1/clusterextension_types.go Added ExtensionConfigBytes() helper method to retrieve user configuration
test/experimental-e2e/single_namespace_support_test.go Added comprehensive e2e tests for SingleNamespace and OwnNamespace install modes with configuration validation
internal/operator-controller/rukpak/render/render_test.go Added unit tests covering default target namespace behavior for various install mode combinations
internal/operator-controller/rukpak/bundle/config_test.go Expanded tests for null/missing watchNamespace configurations and validation errors
testdata/images/bundles/* Added fixtures for single-namespace-operator and own-namespace-operator test bundles
testdata/images/catalogs/test-catalog/v1/configs/catalog.yaml Added catalog entries for new test operators

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva perdasilva force-pushed the own-namespace-config branch 2 times, most recently from 2a716d7 to 8034767 Compare October 23, 2025 16:08
Copilot AI review requested due to automatic review settings October 23, 2025 16:08
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 16 out of 16 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva perdasilva force-pushed the own-namespace-config branch from 8034767 to 443d7a2 Compare October 23, 2025 16:09
Copilot AI review requested due to automatic review settings October 23, 2025 16:31
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 16 out of 16 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva perdasilva force-pushed the own-namespace-config branch from 4b37d8c to 0ea85d7 Compare October 23, 2025 16:38
@perdasilva perdasilva requested a review from Copilot October 23, 2025 17:25
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 16 out of 16 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva perdasilva force-pushed the own-namespace-config branch from 0ea85d7 to a02080d Compare October 23, 2025 17:42
Copilot AI review requested due to automatic review settings October 23, 2025 19:06
@perdasilva perdasilva force-pushed the own-namespace-config branch from e392d2b to 55bdb12 Compare October 23, 2025 19:06
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 15 out of 15 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva perdasilva force-pushed the own-namespace-config branch from 55bdb12 to d927b43 Compare October 23, 2025 19:10
Per G. da Silva added 8 commits October 23, 2025 12:13
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
Copilot AI review requested due to automatic review settings October 23, 2025 19:13
@perdasilva perdasilva force-pushed the own-namespace-config branch from d927b43 to f995320 Compare October 23, 2025 19:13
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 15 out of 15 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@perdasilva
Copy link
Contributor Author

Just because of the new method added to the public API (exported). I think we should move it out of the API package. → https://github.com/operator-framework/operator-controller/pull/2283/files#r2456565041

I've removed that and made it a private utility closer to where it is used

Copy link
Contributor

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

It seems solid for me, LGTM

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2025
@tmshort
Copy link
Contributor

tmshort commented Oct 23, 2025

/approve

@openshift-ci
Copy link

openshift-ci bot commented Oct 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, tmshort

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 8b6debd into operator-framework:main Oct 23, 2025
26 checks passed
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
anik120 added a commit to anik120/enhancements that referenced this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants