Skip to content

Ensure we have appropriate APIs to handle graceful shutdown in Kubernetes for seamless, no downtime upgrades #129

Description

@emanueleaina

Our runners often deal with very long running jobs that may even take 24h to complete.

For that reason, when deploying a new versions it is not reasonable to manually pause the runner and wait for all the jobs to complete before updating and unpausing. Doing so may require keeping the runner paused while a job takes many hours to complete, preventing other jobs from being processed in the meantime.

Kubernetes actually provides a way to handle this situation automatically via graceful shutdowns. In short, we can set a very long terminationGracePeriodSeconds value and, when getting SIGTERM from Kubernetes, stop polling for new jobs and exit once the last running job completes.

This crate already has an API to drain the jobs, but it needs some careful analysis to provide good guidance on how to integrate that in the worker loop wrt. e.g. cancel safety, with some examples.

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions