Repository navigation
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 46c3650. Configure here.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
A virtual Pod can change before its host Pod is created, for example when a scheduling gate is removed while the virtual scheduler is enabled. The two API servers then have different generation histories. Copying the host's
observedGenerationunchanged can leave a genuinely terminated virtual Pod at generation/observedGeneration3/2, then4/2after deletion. Controllers that require current termination evidence cannot safely make progress.Record a host-owned, UID-fenced generation receipt after the translated host object has been accepted by the API server, using the returned generation and an optimistic-lock metadata patch. Translate Pod and condition observations through that receipt in both normal and deleting-host synchronization. A kubelet observation of the host DELETE generation proves the last accepted spec, so it maps to that virtual spec version rather than an unobserved newer virtual version. Missing, stale or mismatched receipts produce unknown observations instead of promoting them to the current generation.
Normalize virtual condition generations back into the host domain before bidirectional merging, and exclude the receipt from virtual annotation updates. Expected optimistic-lock conflicts requeue without emitting a misleading
SyncError; genuine API failures still produce error events. Existing handling for virtual API servers that strip observed-generation fields remains in place.Please provide a short message that should be published in the vcluster release notes
Fixed observed-generation translation for managed Pods with different host and virtual generation histories, including termination during deletion.
What else do we need to know?
vcluster.loft.sh/pod-generation-mappingon the host Pod. It is tied to both Pod UIDs and persists through syncer restarts.Validation:
go test -mod=vendor -p=4 ./pkg/controllers/resources/pods/translate ./pkg/controllers/resources/pods ./pkg/patchergo test -mod=vendor -p=4 -race ./pkg/controllers/resources/pods/translate ./pkg/controllers/resources/pods ./pkg/patcheractiveDeadlineSecondstermination, then ordinary deletion. Virtual generation/observedGeneration progresses through2/2,3/3,4/3.Syncregression verifies quiet conflict requeues and visible forbidden-operation errors.E2E Tests
The mandatory PR suite can run with the default selection. No new Ginkgo suite is introduced.
Note
Medium Risk
Touches core pod sync/status translation and failure signaling; incorrect mapping could misreport termination readiness, though receipts are conservative (unknown when unproven) and conflicts are handled quietly.
Overview
Introduces a host-owned generation receipt (
vcluster.loft.sh/pod-generation-mapping) written on the host Pod after the translated spec is successfully accepted, and uses it to mapobservedGenerationbetween independent host and virtual generation histories.Sync path: After
CreateHostObjectand successful bidirectional patch, the syncer callsRecordPodGenerationMappingwith the API-returned host Pod (patcher.HostObject()). Status projection switches toDesiredVirtualPodStatus, which only translates kubelet-reported generations when the receipt proves which virtual spec the host accepted; otherwise observations are unknown (0). Condition merging normalizes virtual observed generations into the host domain viahostConditionGenerations. The receipt annotation is excluded from virtual annotation sync and stripped when translating virtual→host.Operational behavior: Optimistic-lock conflicts on receipt recording requeue without
SyncErrorevents; non-conflict failures still emit sync errors. Host-deletion status propagation uses the same generation-aware status logic.Tests: New unit/integration coverage for mapping recording, translation edge cases (deletion, stale/missing receipts), and conflict-vs-forbidden receipt patch behavior.
Reviewed by Cursor Bugbot for commit e646cda. Bugbot is set up for automated code reviews on this repo. Configure here.