Skip to content

Add minimal and max wait time to both control plane and Python SDK #989

Description

@pocesar

Summary

Most of the time you'll have an external service paired with the agent node Kubernetes deployment: Redis, a vector DB, the postgres connector itself.
Allows some time to pass before starting to teardown everything

Proposed solution

The idea follows the maxSigtermDelay and minSigtermDelay: https://github.com/GoogleCloudPlatform/cloud-sql-proxy-operator/blob/main/docs/api.md#authproxycontainerspec

When receiving a shutdown event (SIGTERM, SIGINT, etc) either on the control plane itself (a re-deployment or a new version being deployed) or on agents deployments, wait for at least n seconds before fanning out the shutdown signals to in-flight reasoners. And similarly, when an agent (using the python SDK here), it shouldn't kill the process straight away and should wait n < kill < m. A Kubernetes lifecycle.stopSignal: SIGHUP could also be used to differentiate from a hard SIGTERM.

Additionally a /shutdown internal endpoint could be exposed so Kubernetes lifecycle.preStop.httpGet.path: /shutdown could be used natively to start winding down

Alternatives considered

Right now, using a lifecyle.preStop.sleep with a obscene high number until it get SIGTERM'd. Some agent reasoners can take 4 minutes to complete, and 90% of the time it gets killed anyway.
The drawback is that new deployments take just as much to be live

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions