Skip to content

🐛ClusterExtension configurations using watchNamespace: "" (empty string) no longer fail with a confusing validation error.#2348

Closed
camilamacedo86 wants to merge 1 commit into
operator-framework:mainfrom
camilamacedo86:fix-empty-string
Closed

🐛ClusterExtension configurations using watchNamespace: "" (empty string) no longer fail with a confusing validation error.#2348
camilamacedo86 wants to merge 1 commit into
operator-framework:mainfrom
camilamacedo86:fix-empty-string

Conversation

@camilamacedo86
Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings November 19, 2025 07:36
@camilamacedo86 camilamacedo86 requested a review from a team as a code owner November 19, 2025 07:36
@openshift-ci openshift-ci Bot requested review from dtfranz and tmshort November 19, 2025 07:36
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 19, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 1eb4e4a
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/691d77473cd2270008622297
😎 Deploy Preview https://deploy-preview-2348--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.

Copy link
Copy Markdown
Contributor

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 fixes a bug where an empty string value for watchNamespace is now treated as "not provided," defaulting to AllNamespaces install mode instead of causing validation errors.

Key Changes:

  • Modified GetWatchNamespace() to return nil for empty string values, treating them as AllNamespaces mode
  • Updated validation logic to skip validation for empty string watchNamespace, preventing spurious errors
  • Added comprehensive test coverage for empty string handling across different install modes (OwnNamespace, SingleNamespace, AllNamespaces)

Reviewed Changes

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

File Description
internal/operator-controller/config/config.go Added empty string checks in GetWatchNamespace() and custom format validators to treat empty strings as AllNamespaces mode
internal/operator-controller/config/config_test.go Added three test cases verifying empty string watchNamespace is accepted and treated as nil for different install mode combinations
test/e2e/single_namespace_support_test.go Added new e2e test TestClusterExtensionEmptyWatchNamespace that verifies empty watchNamespace configuration results in successful AllNamespaces mode installation

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

@camilamacedo86 camilamacedo86 changed the title 🐛 fix: Treat empty watchNamespace value as not provided, defaulting to AllNamespaces install mode 🐛 fix: ClusterExtension with empty watchNamespace ("") should install successfully (same as omitting field) but returns "unknown field" error Nov 19, 2025
@camilamacedo86 camilamacedo86 changed the title 🐛 fix: ClusterExtension with empty watchNamespace ("") should install successfully (same as omitting field) but returns "unknown field" error 🐛 fix: When a ClusterExtension is configured with watchNamespace: "" (empty string), it fails with a confusing error message. Empty string should be accepted - Empty means "not informed" and should work like null or omitting the field Nov 19, 2025
@camilamacedo86 camilamacedo86 changed the title 🐛 fix: When a ClusterExtension is configured with watchNamespace: "" (empty string), it fails with a confusing error message. Empty string should be accepted - Empty means "not informed" and should work like null or omitting the field 🐛 fix: ClusterExtension configurations using watchNamespace: "" (empty string) no longer fail with a confusing validation error. Nov 19, 2025
…string) no longer fail with a confusing validation error.
Copy link
Copy Markdown
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2025
@camilamacedo86 camilamacedo86 changed the title 🐛 fix: ClusterExtension configurations using watchNamespace: "" (empty string) no longer fail with a confusing validation error. 🐛ClusterExtension configurations using watchNamespace: "" (empty string) no longer fail with a confusing validation error. Nov 19, 2025
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2025
@perdasilva perdasilva self-requested a review November 19, 2025 13:20
@perdasilva perdasilva removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2025
@perdasilva
Copy link
Copy Markdown
Contributor

This is the desired behavior. OLM should not know about the semantics of a bundle configuration. A bundle that only support AllNamespaces does not provide a watchNamespace configuration. Therefore, watchNamespace should be treated as any other non-existing configuration key.

Copy link
Copy Markdown
Member

@rashmigottipati rashmigottipati left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Nov 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pedjak, perdasilva, rashmigottipati

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

The pull request process is described here

Details 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 Nov 19, 2025
@perdasilva perdasilva removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2025
@tmshort
Copy link
Copy Markdown
Contributor

tmshort commented Nov 19, 2025

This is the desired behavior. OLM should not know about the semantics of a bundle configuration. A bundle that only support AllNamespaces does not provide a watchNamespace configuration. Therefore, watchNamespace should be treated as any other non-existing configuration key.

@perdasilva do you not approve (although you gave it LGTM), or are you asking for someone else to tag it approved?

@perdasilva
Copy link
Copy Markdown
Contributor

/hold I don't think this is a bug

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 19, 2025
@perdasilva
Copy link
Copy Markdown
Contributor

This is the desired behavior. OLM should not know about the semantics of a bundle configuration. A bundle that only support AllNamespaces does not provide a watchNamespace configuration. Therefore, watchNamespace should be treated as any other non-existing configuration key.

@perdasilva do you not approve (although you gave it LGTM), or are you asking for someone else to tag it approved?

I did originally approve. But then it occurred to me it's not right and I took the label away. I've put it on hold now until I can clarify everything with Camila

@camilamacedo86
Copy link
Copy Markdown
Contributor Author

I’m closing this one.
I agree with @perdasilva.

I get up today, and start to look on it and I don’t think it’s maintainable for us to support that. It would require normalizing every option and flag, which leads to a worse UX overall. Some options treat an empty string as nil, others don’t, and we don’t have a reliable or consistent way to handle that across the board.

Close it. We should not do it.

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

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants