We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
UID
When using server side apply with ExtractPod, a controller may recreate a resource that was deleted by attempting to remove a finalizer.
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:
podApplyConfig, err := coreac.ExtractPod(pod, fm) if err != nil { return fmt.Errorf("coreac.ExtractPod: %w", err) } // updating something podApplyConfig.Finalizers = nil _, err = w.client.CoreV1().Pods(ns).Apply(ctx, podApplyConfig, meta.ApplyOptions{FieldManager: smtg}) if err != nil { return fmt.Errorf("client.Apply: %w", err) }
The SharedInformer sometimes sends the event multiple times, which leads to pod being recreated after deletion, given this scenario:
SharedInformer
Kubernetes specs specify that:
Create is blocked on apply if uid is provided link
See KEPS
We can manually call podApply := podApply.WithUID(pod.UID) to workaround this.
podApply := podApply.WithUID(pod.UID)
However, I think that it would be better that ExtractPod (and similar method for other resources) sets the UID before returning it.
ExtractPod
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:
No branches or pull requests
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: