patcher: avoid stale resourceVersion conflicts on object updates#3869
patcher: avoid stale resourceVersion conflicts on object updates#3869mayooot wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 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".
| return fmt.Errorf("get object: %w", err) | ||
| } else if err == nil { | ||
| isUpdate = true | ||
| obj = currentObj |
There was a problem hiding this comment.
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 👍 / 👎.
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:
Additional test suites
Additional test suite(s) that will be executed before the mandatory PR suite: