Server-Side Apply: ExtractPod should specify UID
#1346
Labels
lifecycle/rotten
Denotes an issue or PR that has aged beyond stale and will be auto-closed.
UID
#1346
TLDR
When using server side apply with ExtractPod, a controller may recreate a resource that was deleted by attempting to remove a finalizer.
Context
I have a controller that watches pods to remove finalizer using Server-Side Apply (to avoid race condition between controllers as suggested here).
It removes the finalizer in the following way:
The
SharedInformer
sometimes sends the event multiple times, which leads to pod being recreated after deletion, given this scenario:Fix
Kubernetes specs specify that:
See KEPS
We can manually call
podApply := podApply.WithUID(pod.UID)
to workaround this.However, I think that it would be better that
ExtractPod
(and similar method for other resources) sets the UID before returning it.client-go/applyconfigurations/core/v1/pod.go
Lines 72 to 84 in aa7909e
WDYT?
I can make a PR if that sounds good to you.
However, this part of the codebase seems to be generated, so I'd need a hint on where to edit that.
Thanks!
The text was updated successfully, but these errors were encountered: