Skip to content

OCPBUGS-79520: Fix kebab actions on Installed Operators list page#16682

Open
TheRealJon wants to merge 1 commit into
openshift:mainfrom
TheRealJon:OCPBUGS-79520
Open

OCPBUGS-79520: Fix kebab actions on Installed Operators list page#16682
TheRealJon wants to merge 1 commit into
openshift:mainfrom
TheRealJon:OCPBUGS-79520

Conversation

@TheRealJon

@TheRealJon TheRealJon commented Jun 25, 2026

Copy link
Copy Markdown
Member

Analysis / Root cause:
The Installed Operators list page was showing incorrect kebab menu actions. Instead of displaying "Edit Subscription" and "Uninstall Operator" for installed operators, it only showed "Delete ClusterServiceVersion". This occurred for operators in both "Installing" and "Succeeded" status.

Root cause: subscriptionForCSV() helper function had unnecessary guards (operatorNamespace && and csvName &&) that prevented matching when the olm.operatorNamespace annotation was missing. When operatorNamespaceFor(csv) returned undefined and fell back to csv.metadata.namespace, the truthy guard still failed, preventing the function from finding the matching subscription even when one existed.

Solution description:
Removed the unnecessary operatorNamespace && and csvName && guards from the matching logic in subscriptionForCSV(). Kubernetes objects always have name and namespace properties, so these guards were not needed. The function now correctly matches subscriptions whether or not the olm.operatorNamespace annotation is present:

  • With annotation → uses annotation namespace
  • Without annotation → falls back to CSV metadata.namespace
  • Both cases now match subscriptions correctly

Added comprehensive test coverage with 8 test cases covering all matching scenarios including edge cases.

Screenshots / screen recording:

Test setup:

  1. Install an operator from OperatorHub
  2. Navigate to Operators → Installed Operators

Test cases:

  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Succeeded" status
  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Installing" status
  • Verify "Delete ClusterServiceVersion" only appears for CSVs without subscriptions (e.g., copied CSVs)
  • Verify unit tests pass: yarn test packages/operator-lifecycle-manager/src/status/__tests__/csv-status.spec.ts

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
Related to CONSOLE-4685 which refactored CSV actions. That PR added the fallback logic but kept the guards, which caused this regression.

Reviewers and assignees:
/assign @spadgett
/cc @openshift/team-olm

Jira: https://redhat.atlassian.net/browse/OCPBUGS-79520

Summary by CodeRabbit

  • Bug Fixes

    • Improved subscription matching so operator lifecycle status works correctly even when namespace values are empty or missing.
    • Fixed cases where valid subscriptions were previously ignored due to stricter matching checks.
  • Tests

    • Added coverage for multiple subscription-to-CSV matching scenarios, including namespace differences, missing installed CSV values, and edge cases with empty namespaces.

subscriptionForCSV had unnecessary guards checking operatorNamespace
and csvName were truthy before matching. When operatorNamespaceFor
returned undefined and fallback to csv.metadata.namespace produced
falsy value, guard prevented matching even when valid subscription
existed with same namespace and installedCSV.

Removed operatorNamespace && csvName && guards. Kubernetes objects
always have name/namespace, so guards unnecessary. Matching now
works correctly with or without olm.operatorNamespace annotation.

Added comprehensive test coverage for all matching scenarios including
edge cases.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@TheRealJon: This pull request references Jira Issue OCPBUGS-79520, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.22.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
The Installed Operators list page was showing incorrect kebab menu actions. Instead of displaying "Edit Subscription" and "Uninstall Operator" for installed operators, it only showed "Delete ClusterServiceVersion". This occurred for operators in both "Installing" and "Succeeded" status.

Root cause: subscriptionForCSV() helper function had unnecessary guards (operatorNamespace && and csvName &&) that prevented matching when the olm.operatorNamespace annotation was missing. When operatorNamespaceFor(csv) returned undefined and fell back to csv.metadata.namespace, the truthy guard still failed, preventing the function from finding the matching subscription even when one existed.

Solution description:
Removed the unnecessary operatorNamespace && and csvName && guards from the matching logic in subscriptionForCSV(). Kubernetes objects always have name and namespace properties, so these guards were not needed. The function now correctly matches subscriptions whether or not the olm.operatorNamespace annotation is present:

  • With annotation → uses annotation namespace
  • Without annotation → falls back to CSV metadata.namespace
  • Both cases now match subscriptions correctly

Added comprehensive test coverage with 8 test cases covering all matching scenarios including edge cases.

Screenshots / screen recording:

Test setup:

  1. Install an operator from OperatorHub
  2. Navigate to Operators → Installed Operators

Test cases:

  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Succeeded" status
  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Installing" status
  • Verify "Delete ClusterServiceVersion" only appears for CSVs without subscriptions (e.g., copied CSVs)
  • Verify unit tests pass: yarn test packages/operator-lifecycle-manager/src/status/__tests__/csv-status.spec.ts

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
Related to CONSOLE-4685 which refactored CSV actions. That PR added the fallback logic but kept the guards, which caused this regression.

Reviewers and assignees:
/assign @spadgett
/cc @openshift/team-olm

Jira: https://redhat.atlassian.net/browse/OCPBUGS-79520

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@TheRealJon: GitHub didn't allow me to request PR reviews from the following users: openshift/team-olm.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

Analysis / Root cause:
The Installed Operators list page was showing incorrect kebab menu actions. Instead of displaying "Edit Subscription" and "Uninstall Operator" for installed operators, it only showed "Delete ClusterServiceVersion". This occurred for operators in both "Installing" and "Succeeded" status.

Root cause: subscriptionForCSV() helper function had unnecessary guards (operatorNamespace && and csvName &&) that prevented matching when the olm.operatorNamespace annotation was missing. When operatorNamespaceFor(csv) returned undefined and fell back to csv.metadata.namespace, the truthy guard still failed, preventing the function from finding the matching subscription even when one existed.

Solution description:
Removed the unnecessary operatorNamespace && and csvName && guards from the matching logic in subscriptionForCSV(). Kubernetes objects always have name and namespace properties, so these guards were not needed. The function now correctly matches subscriptions whether or not the olm.operatorNamespace annotation is present:

  • With annotation → uses annotation namespace
  • Without annotation → falls back to CSV metadata.namespace
  • Both cases now match subscriptions correctly

Added comprehensive test coverage with 8 test cases covering all matching scenarios including edge cases.

Screenshots / screen recording:

Test setup:

  1. Install an operator from OperatorHub
  2. Navigate to Operators → Installed Operators

Test cases:

  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Succeeded" status
  • Verify kebab menu shows "Edit Subscription" and "Uninstall Operator" for operators in "Installing" status
  • Verify "Delete ClusterServiceVersion" only appears for CSVs without subscriptions (e.g., copied CSVs)
  • Verify unit tests pass: yarn test packages/operator-lifecycle-manager/src/status/__tests__/csv-status.spec.ts

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:
Related to CONSOLE-4685 which refactored CSV actions. That PR added the fallback logic but kept the guards, which caused this regression.

Reviewers and assignees:
/assign @spadgett
/cc @openshift/team-olm

Jira: https://redhat.atlassian.net/browse/OCPBUGS-79520

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.

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TheRealJon

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 component/olm Related to OLM approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5e1ecb68-da95-4e65-8d08-0a99958e58b4

📥 Commits

Reviewing files that changed from the base of the PR and between 063caae and 4abafdb.

📒 Files selected for processing (2)
  • frontend/packages/operator-lifecycle-manager/src/status/__tests__/csv-status.spec.ts
  • frontend/packages/operator-lifecycle-manager/src/status/csv-status.ts

Walkthrough

subscriptionForCSV now compares namespace and installed CSV values directly. A new Jest suite covers matching and non-matching CSV/subscription cases, including missing annotations, empty subscriptions, missing installedCSV, and an empty CSV namespace edge case.

Changes

CSV subscription matching

Layer / File(s) Summary
Predicate and tests
frontend/packages/operator-lifecycle-manager/src/status/csv-status.ts, frontend/packages/operator-lifecycle-manager/src/status/__tests__/csv-status.spec.ts
subscriptionForCSV now checks namespace and installed CSV equality directly, and the Jest suite covers matching, mismatched namespace, mismatched installed CSV, empty subscriptions, missing installedCSV, and empty CSV namespace behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • fsgreco
  • spadgett
🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the bug ticket and the main user-facing fix on the Installed Operators list page.
Description check ✅ Passed The description fills the required template sections with root cause, solution, test setup, test cases, and reviewers; only some optional fields remain partial.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All test titles in csv-status.spec.ts are static, descriptive strings; no dynamic names, timestamps, UUIDs, or generated identifiers appear.
Test Structure And Quality ✅ Passed PASS: This is a small Jest unit test suite; each case is isolated, no external resources/timeouts, and it matches surrounding repo test style.
Microshift Test Compatibility ✅ Passed The new test is a Jest unit suite in csv-status.spec.ts, not a Ginkgo e2e test, and it doesn't use MicroShift-unsupported APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only a Jest unit test was added; no Ginkgo e2e test or multi-node/SNO-specific assumption is present.
Topology-Aware Scheduling Compatibility ✅ Passed Changes are limited to csv status helper logic and Jest tests; no manifests, controllers, pod specs, or topology-aware scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added; the touched files are pure helpers/Jest tests and contain no main/init/TestMain/BeforeSuite/klog/log stdout usage.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only a Jest unit test was added; no Ginkgo e2e tests or IPv4/external-network assumptions found.
No-Weak-Crypto ✅ Passed Touched files only adjust subscription matching; no MD5/SHA1/DES/RC4/3DES/ECB, custom crypto, or secret comparisons were introduced.
Container-Privileges ✅ Passed Only csv-status.ts and csv-status.spec.ts changed; no Kubernetes manifests or privileged/host* security settings are present.
No-Sensitive-Data-In-Logs ✅ Passed Touched files add only pure matching logic and tests; no logging statements or sensitive data patterns were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@TheRealJon: all tests passed!

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

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. component/olm Related to OLM jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants