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

Scale down StatefulSet to 0 before deleting to terminate pods gracefully #843

Open
anveshreddy18 opened this issue Jul 25, 2024 · 0 comments
Labels
area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)

Comments

@anveshreddy18
Copy link
Contributor

How to categorize this issue?

/area robustness
/kind enhancement

What would you like to be added:

Upon deletion of an Etcd, the current deletion flow for StatefulSet attempts to delete it directly as follows :

func (r _resource) TriggerDelete(ctx component.OperatorContext, etcdObjMeta metav1.ObjectMeta) error {
objectKey := getObjectKey(etcdObjMeta)
ctx.Logger.Info("Triggering deletion of StatefulSet", "objectKey", objectKey)
if err := r.client.Delete(ctx, emptyStatefulSet(etcdObjMeta)); err != nil {

However, as per the Kubernetes statefulset limitations, it says

StatefulSets do not provide any guarantees on the termination of pods when a StatefulSet is deleted. To achieve ordered and graceful termination of the pods in the StatefulSet, it is possible to scale the StatefulSet down to 0 prior to deletion

In order to avoid the scenario of orphaned pods and to finish the deletion of statefulset gracefully, it would be better if sts is scaled-down before deleting it.

Why is this needed:

@gardener-robot gardener-robot added area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension labels Jul 25, 2024
@anveshreddy18 anveshreddy18 added the priority/4 Priority (lower number equals higher priority) label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/robustness Robustness, reliability, resilience related kind/enhancement Enhancement, improvement, extension priority/4 Priority (lower number equals higher priority)
Projects
None yet
Development

No branches or pull requests

2 participants