Repository navigation
Description
Motivation
A platform that runs Sōzu in front of many applications wants to enable health checks on every cluster by default, so that a blackholed backend (one that never completes the TCP handshake) is taken out of rotation before requests pay its connect timeout as a 504 (see #1800 for the data-path side of the same problem).
Today the probe is always an HTTP GET <uri> and a backend is healthy only for a 2xx (or one exact expected_status). A default probe on / would therefore mark down every application that answers / with a 3xx, 401 or 404. If all backends of a cluster end up down, Sōzu fails open and routes to all of them, and the 504s come back. For such a platform the useful signal is only "the backend accepts connections"; whether the application answers 500 is the application's business.
Proposal
(a) Probe mode
Add a mode to HealthCheckConfig:
http(default): the current behaviour, unchanged. Existing configurations, saved states and clients keep working as they are.tcp: the backend is healthy iff a TCP connection to it is established withintimeout. The probe sends no bytes and closes the connection cleanly (FIN) once it is established.uri,expected_statusand the accepted statuses are ignored.
Protocol compatibility: uri stays required string uri = 1 on the wire (turning it optional would change the generated Rust type for every consumer). The TOML key and the --uri CLI flag become optional and default to /; in tcp mode the value is ignored. The new fields use new field numbers with defaults, so an older peer ignores them and a message without them decodes as http.
(b) Configurable accepted statuses in HTTP mode
- The path stays configurable (
uri, e.g./livez,/healthz,/readyzfollowing the Kubernetes convention). - New
accepted_statuses: a list of single codes and inclusive ranges. TOML/CLI syntax:"200","200-399","2xx", and"any"(any valid status100-599, i.e. any well-formed HTTP response is healthy). Codes outside100-599are rejected. expected_statuskeeps its meaning (0= any 2xx,N= exactlyN) whenaccepted_statusesis empty. Setting both a non-zeroexpected_statusand a non-emptyaccepted_statusesis rejected at validation (CLI, TOML,SetHealthCheck,AddCluster) instead of letting one silently override the other.
Thresholds, interval, metrics (health_check.*), events and fail-open behaviour stay the same in both modes.
(c) Later direction (out of scope)
Per-application advanced checks configured by the platform (an HTTP check with a chosen path and accepted statuses) replacing the tcp default for the applications that opt in. Nothing in Sōzu is needed beyond (a) and (b) for that.
Activity
fix(health-check): judge the final status, refuse status fields in TC…
test(health-check): exercise the HPACK dynamic table across h2c inter…
feat(health-check): add a TCP connect probe mode and configurable acc…