Server pods keep serving while they leave the Services #44
No files matched your search
@@ -132,3 +132,6 @@ runs, pinned by digest.
|
||||
policies, then the upgrade check (nothing to do on a new store), then the
|
||||
seed, which Argo runs on every sync and which does nothing on a seeded
|
||||
store.
|
||||
- `server.shutdownDelaySeconds` (5 by default): a stopping server pod keeps
|
||||
serving that long, with a `preStop` sleep, while Kubernetes takes it out
|
||||
of the Services, so a request routed to it in that moment isn't refused.
|
||||
@@ -385,6 +385,11 @@ Used for every group that sets no resources of its own
|
||||
Allowed: at least 0.\
|
||||
Time for SMTP sessions in progress to finish when a pod stops
|
||||
|
||||
- **`server.shutdownDelaySeconds`** (integer)\
|
||||
Default: `5`.\
|
||||
Allowed: at least 0; at most 60.\
|
||||
Seconds a stopping pod keeps serving before the server is told to stop, while Kubernetes takes it out of the Services. Without it, a request routed in that moment finds the port closed. 0 turns it off; it counts toward terminationGracePeriodSeconds.
|
||||
|
||||
### `server.topologySpread`
|
||||
|
||||
Pods of a group are spread across nodes (never two on one node while another node has room) and, where the cluster has zones, across zones.
|
||||
|
||||
@@ -285,6 +285,16 @@ spec:
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
{{- if gt (int $server.shutdownDelaySeconds) 0 }}
|
||||
{{- if ge (int $server.shutdownDelaySeconds) (int $server.terminationGracePeriodSeconds) }}
|
||||
{{- fail "server.shutdownDelaySeconds must be less than server.terminationGracePeriodSeconds" }}
|
||||
{{- end }}
|
||||
lifecycle:
|
||||
# Keeps serving while the pod leaves the Services' endpoints
|
||||
preStop:
|
||||
sleep:
|
||||
seconds: {{ int $server.shutdownDelaySeconds }}
|
||||
{{- end }}
|
||||
readinessProbe:
|
||||
# Ready while the data store answers
|
||||
httpGet:
|
||||
|
||||
@@ -339,3 +339,29 @@ tests:
|
||||
- notExists:
|
||||
path: spec.template.spec.initContainers
|
||||
|
||||
|
||||
- it: keeps serving for a moment while a stopping pod leaves the Services
|
||||
template: server/deployment.yaml
|
||||
documentIndex: 0
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].lifecycle.preStop.sleep.seconds
|
||||
value: 5
|
||||
|
||||
- it: leaves the delay out at 0
|
||||
set:
|
||||
server.shutdownDelaySeconds: 0
|
||||
template: server/deployment.yaml
|
||||
documentIndex: 0
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.template.spec.containers[0].lifecycle
|
||||
|
||||
- it: refuses a delay as long as the grace period
|
||||
set:
|
||||
server.shutdownDelaySeconds: 30
|
||||
server.terminationGracePeriodSeconds: 30
|
||||
template: server/deployment.yaml
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: shutdownDelaySeconds must be less than
|
||||
@@ -535,6 +535,11 @@
|
||||
"type": "integer",
|
||||
"minimum": 0
|
||||
},
|
||||
"shutdownDelaySeconds": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 60
|
||||
},
|
||||
"topologySpread": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
|
||||
@@ -227,6 +227,12 @@ server:
|
||||
# Time for SMTP sessions in progress to finish when a pod stops
|
||||
terminationGracePeriodSeconds: 120
|
||||
|
||||
# Seconds a stopping pod keeps serving before the server is told to stop,
|
||||
# while Kubernetes takes it out of the Services. Without it, a request
|
||||
# routed in that moment finds the port closed. 0 turns it off; it counts
|
||||
# toward terminationGracePeriodSeconds.
|
||||
shutdownDelaySeconds: 5
|
||||
|
||||
# Pods of a group are spread across nodes (never two on one node while
|
||||
# another node has room) and, where the cluster has zones, across zones.
|
||||
topologySpread:
|
||||
|
||||
Reference in new issue
Block a user