mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #187] fix(k8s): bound agentenv preStop drain loop with retries and deadline #237
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#237
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/187
Author: @epicvinny
Created: 8/18/2026
Status: 🔄 Open
Base:
main← Head:upstream/prestop-bounded-drain📝 Commits (1)
32428ccfix(k8s): bound agentenv preStop drain loop with retries and deadline📊 Changes
1 file changed (+20 additions, -5 deletions)
View changed files
📝
deploy/k8s/base/agentenv-daemonset.yaml(+20 -5)📄 Description
What
Bounds the
agentenv-nodeDaemonSetpreStopdrain loop indeploy/k8s/base/agentenv-daemonset.yaml:GET /sandboxes(with linear backoff), then the hook exits 0 — if the local API is gone there is nothing left to drain.curl --max-time 5so a hung connection cannot stall the loop.Why
The hook polled the local API in an unbounded
while trueloop. When the endpoint was unreachable (or sandboxes never drained), the hook never exited and — withterminationGracePeriodSeconds: 3600— the pod stayedTerminatingfor up to an hour.Observed in staging: one
agentenv-nodepod stuck inTerminating, recovered only viakubectl delete pod --force --grace-period=0. The force-delete then raced the replacement pod on the sharedhostPath(/var/lib/aenv) state, contributing to the RocksDBLOCKcontention addressed separately in the orphan-process/lock-retry PR.Scope and non-goals
terminationGracePeriodSecondsor the graceful-shutdown semantics of the agent itself; the drain policy (who deletes sandboxes before termination) is unchanged.Compatibility and operations
Validation
yaml.safe_load) and the embedded script passessh -ncurl/jq: clean drain (exit 0 immediately), unreachable API (5 attempts with backoff, exit 0), never-draining API (global deadline, exit 0)make test-unit(N/A: manifest-only change, no Rust code touched)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.