operator icon indicating copy to clipboard operation
operator copied to clipboard

When the VMAgent CR is deleted, the corresponding StatefulSet is left behind.

Open glidea opened this issue 2 years ago • 0 comments

Problem

When a VMAgent CR is deleted, the expected behavior is that the deletion of the CR will be blocked until the associated StatefulSet is deleted. However, there's a chance that the CR gets deleted while the StatefulSet is still being blocked by the finalizer.

Reproduction Steps

  1. Create a VMAgent CR.
  2. Quickly delete the VMAgent CR.

Root Cause Analysis

  1. Once the StatefulSet corresponding to the CR is created, the operator's informer has not yet received the StatefulSet creation event.
  2. If the CR is deleted at this point, the operator's cache client is unable to retrieve the StatefulSet, leading to the assumption that the finalizer has already been removed, as seen in the code from vmagent.go
  3. This results in the removal of the CR's finalizer, as indicated by the code from common.go

glidea avatar Dec 28 '23 03:12 glidea