Server pods keep serving while they leave the Services #44

Merged
jcoffey-dev merged 1 commits from fix/server-shutdown-delay into main 2026-11-20 22:58:45 +00:00
Owner

The server closes its listeners on SIGTERM, and Kubernetes takes a stopping pod out of the Services' endpoints at the same time, not before. A request routed to it in between finds the port closed. The lab's GitOps upgrade test, made strict in inbuxa-k8s-lab#40, caught one webmail request failing that way (502, could not reach the mail server) on arm64.

server.shutdownDelaySeconds (default 5) is a kubelet preStop sleep (stable since 1.34; the chart needs 1.35), so the image needs no sleep binary. 0 turns it off; it must be less than terminationGracePeriodSeconds. Schema, unit tests, values reference and CHANGELOG included; tools/check.sh passes.

Tracker: #14

The server closes its listeners on SIGTERM, and Kubernetes takes a stopping pod out of the Services' endpoints at the same time, not before. A request routed to it in between finds the port closed. The lab's GitOps upgrade test, made strict in inbuxa-k8s-lab#40, caught one webmail request failing that way (502, could not reach the mail server) on arm64. `server.shutdownDelaySeconds` (default 5) is a kubelet `preStop` sleep (stable since 1.34; the chart needs 1.35), so the image needs no sleep binary. 0 turns it off; it must be less than `terminationGracePeriodSeconds`. Schema, unit tests, values reference and CHANGELOG included; `tools/check.sh` passes. Tracker: #14
jcoffey-dev added 1 commit 2026-11-20 22:53:48 +00:00
Server pods keep serving while they leave the Services
ci / chart (pull_request) Successful in 1m8s
lab / e2e the lab on GitHub passed
af7bca629d
The server closes its listeners as soon as it gets SIGTERM, and Kubernetes
takes a stopping pod out of the Services' endpoints at the same time, not
before. A request routed to the pod in between finds the port closed: the
lab's GitOps upgrade saw a webmail request fail with "could not reach the
mail server" that way, once in four runs.

server.shutdownDelaySeconds (5 by default) is a preStop sleep, the kubelet's
own (stable since Kubernetes 1.34; the chart needs 1.35), so the image
needs no sleep binary. 0 turns it off; it has to be less than
terminationGracePeriodSeconds, which it counts toward.
jcoffey-dev merged commit 6d91bb034a into main 2026-11-20 22:58:45 +00:00
jcoffey-dev deleted branch fix/server-shutdown-delay 2026-11-20 22:58:45 +00:00
Sign in to join this conversation.