Open googs1025 opened 1 month ago
/assign
@damemi @ingvagabund @a7i Do we need this configuration feature?
We've never had a use-case for it, typically eviction needs to happen immediately.
What is your use-case for this?
@a7i thanks for quick reply Within our internal cluster, we have some long-running batch jobs or other business processes. However, when employing the descheduler for evictions (for instance, when the cluster reaches high utilization levels), the business holders wish to have the ability to set gracePeriodSeconds during evictions. This capability ensures that custom cleanup procedures have sufficient time to execute, thereby preventing issues arising from abrupt interruptions.
Furthermore, our SREs, during manual node maintenance using kubectl drain, typically include a reasonable --grace-period flag. We aim to have the same functionality available when utilizing the descheduler for rescheduling, maintaining consistency in the approach across both evictions and node maintenance operations.
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#create-eviction-pod-v1-core eviction API does not currently provides means to specify gracePeriodSeconds.
the user can set it from the configuration file and pass it to the deleteOptions of evict.
@googs1025 I wonder how this works. Have you had a chance to implement it and see whether it works?
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#create-eviction-pod-v1-core eviction API does not currently provides means to specify gracePeriodSeconds.
We currently use client.PolicyV1().Evictions(eviction.Namespace).Evict(ctx, eviction)
to perform evictions, which contains the DeleteOptions option. Simply passing in the configuration should work.
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#eviction-v1-policy
the user can set it from the configuration file and pass it to the deleteOptions of evict.
@googs1025 I wonder how this works. Have you had a chance to implement it and see whether it works?
This is a WIP pr: https://github.com/kubernetes-sigs/descheduler/pull/1538
Is your feature request related to a problem? Please describe.
GracePeriodSeconds is important for setting up evictions because it ensures that Pods have enough time to perform necessary cleanup operations before being deleted, thereby ensuring data consistency and service availability. Depending on application requirements, setting GracePeriodSeconds appropriately can improve system stability and reliability.
Describe the solution you'd like
https://github.com/kubernetes-sigs/descheduler/blob/ef0c2c1c47c6aa6afb0d08f4a2488d7df004c2f7/pkg/descheduler/evictions/evictions.go#L199-L222
Describe alternatives you've considered
What version of descheduler are you using?
descheduler version:
Additional context