Skip to content

OCPBUGS-8247: return error when --to-multi-arch is used on a multi-arch cluster - #2340

Open
savio87 wants to merge 2 commits into
openshift:mainfrom
savio87:OCPBUGS-8247
Open

OCPBUGS-8247: return error when --to-multi-arch is used on a multi-arch cluster#2340
savio87 wants to merge 2 commits into
openshift:mainfrom
savio87:OCPBUGS-8247

Conversation

@savio87

@savio87 savio87 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Running oc adm upgrade --to-multi-arch on a cluster that is already multi-architecture did not return an error. The existing check only caught the case where a migration was requested (via spec.desiredUpdate.architecture) but not yet completed. After completion, CVO clears that field, so the command would attempt the patch again.

This adds a check on status.desired.architecture to detect clusters that are already running multi-architecture and return a clear error message.

Bug: https://redhat.atlassian.net/browse/OCPBUGS-8247

Changes

  • Added check: if cv.Status.Desired.Architecture == ClusterVersionArchitectureMulti, return "Cluster is already multi-architecture"
  • This runs before the existing spec.desiredUpdate check, which catches in-progress migrations

Summary by CodeRabbit

  • Bug Fixes
    • Improved validation for multi-architecture upgrades.
    • Added a clear error when a cluster is already configured for multi-architecture.
    • Updated the message shown when an upgrade request is already in progress.

@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 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@savio87: This pull request references Jira Issue OCPBUGS-8247, 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:

Summary

Running oc adm upgrade --to-multi-arch on a cluster that is already multi-architecture did not return an error. The existing check only caught the case where a migration was requested (via spec.desiredUpdate.architecture) but not yet completed. After completion, CVO clears that field, so the command would attempt the patch again.

This adds a check on status.desired.architecture to detect clusters that are already running multi-architecture and return a clear error message.

Bug: https://redhat.atlassian.net/browse/OCPBUGS-8247

Changes

  • Added check: if cv.Status.Desired.Architecture == ClusterVersionArchitectureMulti, return "Cluster is already multi-architecture"
  • This runs before the existing spec.desiredUpdate check, which catches in-progress migrations

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 4, 2026

Copy link
Copy Markdown

Walkthrough

The --to-multi-arch flow now rejects duplicate multi-architecture upgrade requests before checking for an existing requested update. The existing requested-update error message also changed.

Changes

Multi-architecture upgrade validation

Layer / File(s) Summary
Validate duplicate upgrade requests
pkg/cli/admin/upgrade/upgrade.go
The command checks whether the cluster is already updating to or has already requested multi-architecture. It returns an error for duplicate requests and uses updated requested-update wording.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • openshift/oc#2339: Modifies the same --to-multi-arch handling and requested-update messaging.

Suggested reviewers: ingvagabund, ardaguclu

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the added error for using --to-multi-arch on an already multi-architecture cluster.
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 The PR changes only pkg/cli/admin/upgrade/upgrade.go; it adds no Ginkgo tests or test titles, so the stability check is not applicable.
Test Structure And Quality ✅ Passed The pull request changes only pkg/cli/admin/upgrade/upgrade.go; no Ginkgo test code, resource setup, waits, or assertions were added or modified.
Microshift Test Compatibility ✅ Passed The pull request changes only pkg/cli/admin/upgrade/upgrade.go and adds no Ginkgo tests, so the MicroShift test compatibility check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The patch changes only pkg/cli/admin/upgrade/upgrade.go and adds no Ginkgo e2e tests or test declarations, so SNO compatibility review is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes only CLI upgrade error handling in pkg/cli/admin/upgrade/upgrade.go; it adds no manifests, controllers, workloads, replicas, affinities, topology constraints, or node selectors.
Ote Binary Stdout Contract ✅ Passed The PR changes only an error string in upgrade.go. OTE main has no stdout writes, and vendored klog defaults logtostderr=true; its Fatal calls therefore use stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The pull request changes only upgrade.go and adds no Ginkgo e2e tests or external network use; the IPv6/disconnected test check is not applicable.
No-Weak-Crypto ✅ Passed The PR changes only multi-architecture validation and error text in upgrade.go; no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons are introduced.
Container-Privileges ✅ Passed The patch changes only one Go error string; it adds no container/Kubernetes manifest or privilege setting such as privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed The PR adds architecture status checks and returns generic error messages about cluster multi-architecture state. No passwords, tokens, PII, session IDs, hostnames, or customer data are logged or e...
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@openshift-ci

openshift-ci Bot commented Aug 4, 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 wking 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 requested review from ardaguclu and ingvagabund August 4, 2026 07:05
@openshift-ci

openshift-ci Bot commented Aug 4, 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.

@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 4, 2026
@savio87

savio87 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Adds a check on status.desired.architecture to detect clusters already running multi-architecture, returning a clear error instead of attempting a redundant patch. Could a maintainer update the target version on OCPBUGS-8247 and run /ok-to-test? Thanks!

Comment thread pkg/cli/admin/upgrade/upgrade.go Outdated

case o.ToMultiArch:
if cv.Status.Desired.Architecture == configv1.ClusterVersionArchitectureMulti {
return fmt.Errorf("Cluster is already multi-architecture")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure the message is precise, the docs say:

	// desired is the version that the cluster is reconciling towards.
	// If the cluster is not yet fully initialized desired will be set
	// with the information available, which may be an image or a tag.
	// +required
	Desired Release `json:"desired"`

So it may be still progressing, I guess.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have to say I don't know exactly how this works, it's just based on the docs.

@savio87

savio87 commented Aug 7, 2026

Copy link
Copy Markdown
Author

Good point @tchapStatus.Desired reflects what the cluster is reconciling towards, not necessarily its current state. Updated the message to "Cluster is already updating to multi-architecture" to account for the case where the transition is still in progress.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/cli/admin/upgrade/upgrade.go (1)

248-252: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression tests for both validation guards.

Use upgrade_test.go to cover these cases:

  • Status.Desired.Architecture == Multi returns the already-multi-architecture error.
  • Spec.DesiredUpdate.Architecture == Multi returns the already-requested error.
  • Both fields set confirm that the status guard runs first.

Assert the exact error messages.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/upgrade.go` around lines 248 - 252, Add regression
tests in upgrade_test.go for the validation logic surrounding
Status.Desired.Architecture and Spec.DesiredUpdate.Architecture: verify each
Multi case returns its exact expected error message, and verify when both are
Multi the status guard’s error is returned first. Use the existing upgrade test
setup and invoke the relevant upgrade validation flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/cli/admin/upgrade/upgrade.go`:
- Around line 248-252: Add regression tests in upgrade_test.go for the
validation logic surrounding Status.Desired.Architecture and
Spec.DesiredUpdate.Architecture: verify each Multi case returns its exact
expected error message, and verify when both are Multi the status guard’s error
is returned first. Use the existing upgrade test setup and invoke the relevant
upgrade validation flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: ff753571-639f-4549-b4c3-9be44e36060d

📥 Commits

Reviewing files that changed from the base of the PR and between 9c7ccc4 and 1c6c84a.

📒 Files selected for processing (1)
  • pkg/cli/admin/upgrade/upgrade.go

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

Labels

jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. 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. 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.

3 participants