Skip to content

OCPBUGS-87009: Handle truncated Operator CR names in list-operands - #16943

Open
savio87 wants to merge 1 commit into
openshift:mainfrom
savio87:OCPBUGS-87009
Open

OCPBUGS-87009: Handle truncated Operator CR names in list-operands#16943
savio87 wants to merge 1 commit into
openshift:mainfrom
savio87:OCPBUGS-87009

Conversation

@savio87

@savio87 savio87 commented Aug 11, 2026

Copy link
Copy Markdown

Summary

  • Fixes "Cannot load Operands" error during uninstall preview for operators whose package.namespace name exceeds 63 characters (e.g. Cluster Observability Operator)
  • OLM truncates Operator CR names to conform to DNS-1123 label rules (max 63 chars), but the findOperator lookup was using the full untruncated name
  • Adds a fallback: if the initial Get returns NotFound and the name exceeds 63 chars, retry with the truncated name (stripped of trailing non-alphanumeric chars)

Test plan

  • Install Cluster Observability Operator in namespace openshift-cluster-observability-operator
  • Verify uninstall preview no longer shows "Cannot load Operands" warning
  • Verify operators with short names (< 63 chars) continue to work as before

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate 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 Aug 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@savio87: This pull request references Jira Issue OCPBUGS-87009, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

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:

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.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • vendor/github.com/operator-framework/kubectl-operator/pkg/action/operator_list_operands.go is excluded by !**/vendor/**, !vendor/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 405c546a-4c02-45e7-be04-c4f8e5557551

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from rhamilto and spadgett August 11, 2026 09:53
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: savio87
Once this PR has been reviewed and has the lgtm label, please assign therealjon for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 11, 2026
@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Hi @savio87. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@savio87

savio87 commented Aug 11, 2026

Copy link
Copy Markdown
Author

This fixes the "Cannot load Operands" error during uninstall preview for operators whose package.namespace name exceeds 63 characters (e.g. Cluster Observability Operator in openshift-cluster-observability-operator).

Root cause: OLM truncates Operator CR names to 63 characters to conform to DNS-1123 label rules, but findOperator in kubectl-operator was constructing the full untruncated name for the lookup, resulting in a NotFound error.

Fix: Adds a fallback in findOperator — if the initial Get returns NotFound and the constructed name exceeds 63 chars, retry with the truncated name (stripped of trailing non-alphanumeric chars). This preserves existing behavior for operators with short names.

Could a maintainer please set the target version on OCPBUGS-87009 and run /ok-to-test? Thanks!

@savio87

savio87 commented Aug 11, 2026

Copy link
Copy Markdown
Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@savio87: This pull request references Jira Issue OCPBUGS-87009, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

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

Labels

jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants