Skip to content

feat(health-check): add a TCP connect probe mode and configurable accepted HTTP statuses #1801

Closed

Description

@FlorentinDUBOIS

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 within timeout. The probe sends no bytes and closes the connection cleanly (FIN) once it is established. uri, expected_status and 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, /readyz following 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 status 100-599, i.e. any well-formed HTTP response is healthy). Codes outside 100-599 are rejected.
  • expected_status keeps its meaning (0 = any 2xx, N = exactly N) when accepted_statuses is empty. Setting both a non-zero expected_status and a non-empty accepted_statuses is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions