Skip to content

fix: preserve rollback resources for remigration - #99

Merged
openshift-merge-bot[bot] merged 1 commit into
mainfrom
migration-rollback-remigration
Nov 13, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
mainfrom
migration-rollback-remigration

Conversation

@tmshort

@tmshort tmshort commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

A rollback can leave catalog-generated resources, such as RBAC, in place after OLMv1 releases them. These resources may not appear in the restored OLMv0 InstallPlan. A subsequent migration can therefore omit them from the initial revision, causing an ownership collision when the catalog revision tries to create them.

Persist the verified resource identities and UIDs on the restored Subscription before removing the ClusterExtension recovery backup. During remigration, include retained resources that are still unowned and match their recorded UIDs, alongside the normal inventory. Missing resources are skipped; replaced or newly controlled resources are rejected. Normal collection remains deduplicated.

Saving the inventory retries resource-version conflicts, revalidates the Subscription spec on each attempt, and avoids rewriting an unchanged annotation. If the Subscription changes or persistence fails, rollback retains the ClusterExtension recovery backup.

This extracts behavior common to #95 and #97 and does not choose a handoff approach. Those PRs will need rebasing after this merges.

Validation

  • make migration/test-unit
  • make lint
  • go test -tags=e2e ./test/e2e/migration -run '^$'

Unit tests cover retained, missing, replaced, claimed, duplicate, and malformed inventory entries, plus retry of a Subscription status conflict and refusal when its spec changes. E2E tests were compiled; they were not run for this PR.

Summary by CodeRabbit

  • New Features
    • Rollback now records verified resource identities on the restored Subscription before removing the backup, helping preserve recovery information.
    • Remigration can collect retained, unowned resources omitted from the original inventory, while skipping missing or duplicate resources and rejecting replaced or newly owned resources.
  • Documentation
    • Updated migration requirements, plans, validation criteria, and end-to-end guidance to reflect rollback and remigration behavior.

Record verified resource identities on the restored Subscription before removing the ClusterExtension backup. Retry conflicting updates and refuse to overwrite a changed Subscription.

During remigration, include retained unowned resources missing from the OLMv0 inventory, skipping missing and duplicate objects while rejecting replacements and newly controlled objects. Add regression tests and update the migration specifications.

Validation: make migration/test-unit; make lint; go test -tags=e2e ./test/e2e/migration -run ^$.
Signed-off-by: Todd Short <tshort@redhat.com>
@openshift-ci
openshift-ci Bot requested review from pedjak and perdasilva November 13, 2026 15:13
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Rollback now saves verified resource identities and UIDs on the restored Subscription before deleting the ClusterExtension backup. Remigration reads that inventory, skips missing or duplicate resources, and rejects replaced or newly controlled resources.

Changes: Rollback Resource Inventory

Layer / File(s) Summary
Persist rollback inventory
migration/pkg/migration/scan.go, migration/pkg/migration/remigration_test.go
Rollback serializes the owned-resource identities and saves them on the restored Subscription with conflict retries. It verifies that the Subscription still exists, is not deleting, and matches the backed-up spec. The tests cover retry behavior and backup preservation when the spec changes.
Collect retained resources during remigration
migration/pkg/migration/remigration.go, migration/pkg/migration/collector.go, migration/pkg/migration/remigration_test.go, specs/20260821-migration-v0-to-v1/*
Remigration reads saved resource identities, skips missing and already-collected resources, and rejects replaced or newly controlled resources. Tests and migration documents describe the inventory and collection behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Migrator
  participant Subscription
  participant ClusterExtensionBackup
  Migrator->>Subscription: Create restored Subscription with identity annotation
  Migrator->>Subscription: Verify Subscription and save annotation
  Migrator->>ClusterExtensionBackup: Delete backup after annotation persistence
Loading
Merge Risk: Minimal · up to 1df22

Rollback now records verified resource identities on the restored Subscription before removing the recovery backup. Remigration includes those retained resources only when they are unchanged and still unowned. No concrete merge-blocking defect was established. The tests exercise the main collection and retry paths, but the end-to-end tests were only compiled, not run.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix: preserve rollback resources for remigration" matches the main change. The PR records verified resource identities and UIDs on the restored Subscription during rollback. Remigration the…
Description check Passed The description covers the summary of the change and its motivation: rollback can leave catalog-generated RBAC in place, and a later migration can then hit an ownership collision. It also lists the be…
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.
Full details: Title check

Explanation

The title "fix: preserve rollback resources for remigration" matches the main change. The PR records verified resource identities and UIDs on the restored Subscription during rollback. Remigration then collects those retained, still-unowned resources even when the OLMv0 inventory omits them. The title is specific, concise, and follows a conventional commit style.

Full details: Description check

Explanation

The description covers the summary of the change and its motivation: rollback can leave catalog-generated RBAC in place, and a later migration can then hit an ownership collision. It also lists the behavior changes, the retry and revalidation logic, the linked PR relationship (#95, #97), and the validation commands with unit test coverage. It follows the template's free-form summary section. The reviewer checklist is not ticked, and no GitHub issue link is provided, so those items are not confirmed. API Go documentation status is not stated.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: d3ad68cd-9c4e-40a8-826a-826a265d2a46
Commits

Reviewing files that changed from the base of the PR and between 6e388d0 and 1df22dd.

Files selected for processing: 8

  • migration/pkg/migration/collector.go
  • migration/pkg/migration/remigration.go
  • migration/pkg/migration/remigration_test.go
  • migration/pkg/migration/scan.go
  • specs/20260821-migration-v0-to-v1/e2e.md
  • specs/20260821-migration-v0-to-v1/plan.md
  • specs/20260821-migration-v0-to-v1/requirements.md
  • specs/20260821-migration-v0-to-v1/validation.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.

@tmshort

tmshort commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

/approve

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 13, 2026

@fgiudici fgiudici left a comment

Copy link
Copy Markdown
Member

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 13, 2026
@perdasilva

Copy link
Copy Markdown

/approve

@openshift-ci

openshift-ci Bot commented Nov 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

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-merge-bot
openshift-merge-bot Bot merged commit 85fefdf into main Nov 13, 2026
14 checks passed
@tmshort
tmshort deleted the migration-rollback-remigration branch November 13, 2026 16:30
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.

3 participants