Skip to content

patcher: avoid stale resourceVersion conflicts on object updates#3869

Open
mayooot wants to merge 1 commit into
loft-sh:mainfrom
mayooot:fix/3746
Open

patcher: avoid stale resourceVersion conflicts on object updates#3869
mayooot wants to merge 1 commit into
loft-sh:mainfrom
mayooot:fix/3746

Conversation

@mayooot
Copy link
Copy Markdown
Contributor

@mayooot mayooot commented Apr 19, 2026

What issue type does this pull request address? (keep at least one, remove the others)

/kind enhancement

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
resolves #3746

Please provide a short message that should be published in the vcluster release notes

Leverage 'retry.RetryOnConflict' to handle resource revison conflicts.

What else do we need to know?
None.

E2E Tests

Default Test Execution

The mandatory PR suite runs automatically. Only specify additional test suites below if needed.

Adding New Test Suites

When adding a new ginkgo test suite:

  • Add labels to the test suite
  • Update label-filter section below to execute the new test suite
  • Verify test suite runs in CI/CD pipeline

Additional test suites

Additional test suite(s) that will be executed before the mandatory PR suite:

none

@mayooot mayooot requested a review from a team as a code owner April 19, 2026 08:16
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74bd1d18c6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/patcher/apply.go
return fmt.Errorf("get object: %w", err)
} else if err == nil {
isUpdate = true
obj = currentObj
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve post-update metadata in cached object

This path now updates latestObj inside the retry loop, but obj is reassigned to the pre-retry snapshot and never refreshed, so later cache writes can use stale metadata (resourceVersion, generation, etc.) from obj instead of the server-returned object. That stale metadata can break cache version bookkeeping (for example the resourceVersion equality guard in pkg/syncer/syncer.go), causing old snapshots to be treated as current in subsequent reconciles. Use the post-update object (afterObj/latestObj) as the metadata source when populating the cache.

Useful? React with 👍 / 👎.

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.

[0.33.1] unhandled errors repeating on cronjobs

1 participant