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
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
maxSigtermDelayandminSigtermDelay: https://github.com/GoogleCloudPlatform/cloud-sql-proxy-operator/blob/main/docs/api.md#authproxycontainerspecWhen 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
nseconds 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 waitn < kill < m. A Kuberneteslifecycle.stopSignal: SIGHUPcould also be used to differentiate from a hardSIGTERM.Additionally a
/shutdowninternal endpoint could be exposed so Kuberneteslifecycle.preStop.httpGet.path: /shutdowncould be used natively to start winding downAlternatives considered
Right now, using a
lifecyle.preStop.sleepwith 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