foriequal0 / pod-graceful-drain

You don't need `lifecycle: { preStop: { exec: { command: ["sleep", "30"] } } }`
Apache License 2.0
246 stars 16 forks source link

Finalizer support #24

Closed nirnanaaa closed 3 years ago

nirnanaaa commented 3 years ago

I'm trying to understand why you made use of admission webhooks instead of finalizers.

With finalizers we wouldn't have to artifically delay anything and could just re-queue the terminating pod to be checked again. Pods would get into "Terminating" state, the load balancer (e.g. aws-alb-load-balancer-controller) would handle removing the pod from the target group and as soon as the pods' ip isn't registered in the LB anymore we could release the finalizer.

Just asking myself whether that's something we could contribute.

foriequal0 commented 3 years ago

I've tried finalizers! Finalizers prevent "Pod"s from being removed, but they don't prevent "Container"s from being "Terminated".

nirnanaaa commented 3 years ago

Good catch. Didn't think of that! You're absolutely right that finalizers only prevent the deletion of the raw objects https://github.com/kubernetes/kubernetes/issues/73584 too Bad. Thanks for your input!