Graceful Shoot Deletion: Hard Timeout vs. Indefinite Wait
0 reputation · 17 Dec 2024, 11:21 UTC
0 reputation · 17 Dec 2024, 11:21 UTC
The Gardener controller supports a configurable grace period for shoot deletion, enabling node draining before cloud resources are terminated. This feature is documented in Gardener v1.80+ and is specified by the Shoot’s deletionGracePeriodSeconds field, which the controller propagates to the provider SDK when possible.
When a provider stalls during cleanup, the overall deletion can exceed the requested grace period. Gardener currently logs context cancellations but does not enforce a hard timeout; the controller may wait indefinitely until the provider completes the cleanup. This behavior is noted in the Gardener issue tracker as an unresolved decision.
The question is whether Gardener should enforce a hard timeout on stalled provider deletions or allow indefinite waiting. The decision would affect reliability, resource reclamation, and user experience across different cloud providers.
Specific questions:
30275 reputation · 17 Dec 2024, 11:38 UTC
Gardener v1.80+ exposes deletionGracePeriodSeconds on the Shoot spec. The controller copies this value into the context it passes to the provider SDK for node draining. Today the controller does not enforce a hard timeout; if a provider’s cleanup stalls, deletion proceeds until the provider finishes or the process is terminated externally.
A hard timeout could be implemented by starting a timer when deletion begins, using a deadline derived from deletionGracePeriodSeconds plus a configurable buffer (e.g., 30 s). When the deadline expires, the controller would cancel the provider‑context and treat the deletion as timed out.
deletionGracePeriodSeconds + timeoutBufferSeconds (default 30 s).context.Cancelled error.DeletionTimeoutExceeded with reason Timeout and a message indicating the grace period was exceeded.Failed (or keep Deleting with the timeout condition) and expose a retryAfterSeconds field suggesting when a retry may be safe.Providers that document bounded cleanup (e.g., AWS ELB deletion within a known window) can safely rely on the timeout; aborting will not leave orphan resources because the provider’s cleanup is guaranteed to finish within the grace period. Providers without such guarantees risk leaving partial resources if the controller aborts mid‑cleanup; in those cases the timeout should be treated as a failure requiring manual cleanup or a retry after the provider’s known maximum duration.
The controller would add a timeout watchdog before invoking the provider’s cleanup hook. On timeout, it would:
Shoot.status.conditions with DeletionTimeoutExceeded.Shoot.status.lastOperation to Failed.retryAfterSeconds field (or annotation) to guide users when a safe retry can be attempted.These changes add a deterministic bound to deletion, improve resource reclamation predictability, and introduce a new status condition that users can monitor via the API.
To refine the recommendation, could you share the provider’s typical maximum cleanup duration observed in your environment?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.