Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent recreating virtual cluster resource during delete #2241

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

lizardruss
Copy link
Contributor

@lizardruss lizardruss commented Oct 22, 2024

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

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

Please provide a short message that should be published in the vcluster release notes
Fixed an issue where the vcluster syncer would mistakenly re-create a resource when reconciling the update event that adds the deletionTimestamp

What else do we need to know?

Scenario

The syncer incorrectly re-creates a resource while it's being deleted. The sequence of events observed:

  • A replicationcontroller with a terminationGracePeriod == 0 is deleted and its pods are garbage collected
  • An update event that sets the deletionTimestamp is queued
  • An delete event for the same resource is queued
  • Syncer reconciles the update event but is unable to load the resource because it's already deleted. This triggers a call to SyncToVirtual(), which mistakenly re-creates the resource.

This scenario occurs more frequently with pods, but the solution has been made generic in case it occurs with different resource kinds.

Solution

Add a PendingDelete event type to communicate that an update event occurred to a virtual resource being deleted. If the SyncToVirtual flow is reached by an event where the source == Virtual and the type == PendingDelete, then skip calling SyncToVirtual.

Copy link

netlify bot commented Oct 22, 2024

Deploy Preview for vcluster-docs canceled.

Name Link
🔨 Latest commit 6cdab63
🔍 Latest deploy log https://app.netlify.com/sites/vcluster-docs/deploys/67198d780587ce00080c68f9

Justfile Outdated Show resolved Hide resolved
@lizardruss lizardruss changed the title wip: moar conformance debugging Prevent recreating virtual cluster resource during delete Oct 24, 2024
@lizardruss lizardruss marked this pull request as ready for review October 24, 2024 02:17
@ThomasK33 ThomasK33 merged commit b683fce into main Oct 24, 2024
63 checks passed
@ThomasK33 ThomasK33 deleted the conformance-debugging-2 branch October 24, 2024 12:19
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