Skip to content

🐛 Fix standalone pods migration by stripping ovn annotations on ocp - #33

Merged
stillalearner merged 3 commits into
migtools:mainfrom
stillalearner:fix_standalone_pods_migration
Jul 9, 2026
Merged

🐛 Fix standalone pods migration by stripping ovn annotations on ocp#33
stillalearner merged 3 commits into
migtools:mainfrom
stillalearner:fix_standalone_pods_migration

Conversation

@stillalearner

@stillalearner stillalearner commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fix standalone pods migration by stripping ovn annotations on OCP

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of pod metadata by removing runtime-injected annotations before updates are applied.
    • Reduced the chance of update failures caused by leftover OpenShift/OVN annotation data.
    • Kept existing pod cleanup behavior while applying the new annotation cleanup automatically.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@stillalearner, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2b3f7e1d-ae91-4b58-a586-429889186b8a

📥 Commits

Reviewing files that changed from the base of the PR and between 40bd3ec and ff1b35d.

📒 Files selected for processing (3)
  • openshift/openshift.go
  • openshift/plugin.go
  • openshift/plugin_test.go
📝 Walkthrough

Walkthrough

Adds a new StripPodRuntimeAnnotations function that generates JSON Patch operations to remove OCP/OVN runtime-injected pod annotations, and integrates it into OpenShiftTransformPlugin.Run's Pod case, appending its resulting patch alongside existing pull secret and security context patches.

Changes

Strip runtime annotations from pods

Layer / File(s) Summary
Annotation stripping helper
openshift/openshift.go
Adds StripPodRuntimeAnnotations(u unstructured.Unstructured) (jsonpatch.Patch, error), which builds remove operations for a fixed set of runtime-injected annotation keys, escapes keys for JSON Pointer, and returns nil, nil when no matching annotations exist.
Plugin wiring for runtime patch
openshift/plugin.go
Pod case in Run invokes StripPodRuntimeAnnotations(u), handles errors by breaking the switch, appends runtimePatch to the final patch list, and simplifies the pod processing log message.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: stripping OVN annotations during standalone pod migration on OpenShift.
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.
✨ 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.

@stillalearner

Copy link
Copy Markdown
Contributor Author

Tested on OCP locally.

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@openshift/plugin.go`:
- Around line 121-126: The Pod-case patching logic in plugin.go is shadowing the
outer error variable, so failures from StripPodRuntimeAnnotations and related
patch steps can be missed by the later error check. Update the Pod branch to
assign into the existing err variable instead of creating case-local copies, and
keep using the shared err for the post-switch failure path so any patching error
is returned properly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b8eed96c-6bd0-4b3c-88eb-e8e945c30179

📥 Commits

Reviewing files that changed from the base of the PR and between fcf91dd and 40bd3ec.

📒 Files selected for processing (2)
  • openshift/openshift.go
  • openshift/plugin.go

Comment thread openshift/plugin.go Outdated
@aufi

aufi commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes issue migtools/crane#614

@aufi aufi left a comment

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.

Thanks for the PR, left 2 comments inline.

Comment thread openshift/openshift.go
Comment thread openshift/openshift.go Outdated

@aufi aufi left a comment

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.

Thanks for update 👍 LGTM!

@stillalearner
stillalearner merged commit ea7d896 into migtools:main Jul 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants