Skip to content

feat(health-check): probe a port other than the backend data port - #1899

Merged
FlorentinDUBOIS merged 4 commits into
mainfrom
feat/health-check-port
Oct 16, 2026
Merged

FlorentinDUBOIS merged 4 commits into
mainfrom
feat/health-check-port

Conversation

@FlorentinDUBOIS

@FlorentinDUBOIS FlorentinDUBOIS commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

HealthCheckConfig gains an optional probe port (protobuf field 9). HTTP and TCP health checks use that port with the backend IP address while ordinary traffic keeps using the backend data endpoint. HTTP Host, h2c :authority and probe logs all use the effective probe address.

The field is optional: unset keeps the existing behavior. The public Rust HealthCheckConfig and FileHealthCheckConfig structures gain the corresponding optional field, so exhaustive literals must initialize it.

Behavior

  • Accept probe ports in 1..=65535 through TOML, protobuf state and cluster health-check set --port.
  • Show the effective probe port in health-check list, with data when the override is unset.
  • Preserve the selected backend incarnation while probing, and dial connect_backend(probe_address, unix_path) so the port override reaches IP backends and a UNIX backend still uses its socket.
  • Refuse health_check.port together with a unix_path backend before mutation in file configuration, ConfigState and workers, whichever order introduces the conflict.
  • Keep valid UNIX-to-IP-plus-port and reverse transitions convergent through ConfigState::diff, static reload and SaveState/LoadState. Only the conflicting AddCluster is deferred until the backend replacement has completed.
  • Preserve an already-unhealthy backend and its counters when an identical IP-plus-port configuration is reloaded. Removing the health check, or applying AddCluster without one, still resets health state as documented.

Mixed-version compatibility

The port travels on existing AddCluster and SetHealthCheck messages. A worker older than 2.3.2 can decode the message, ignore field 9 and probe the data port. Upgrade the main process and every worker to 2.3.2 before enabling health_check.port.

The request verbs introduced for header routing, silent_close and UNIX backends retain their fail-closed old-worker behavior.

Validation

  • RED/GREEN regression coverage for the UNIX-to-IP-plus-port transition in ConfigState::diff, static reload and SaveState/LoadState, including the reverse direction.
  • RED/GREEN socket-transport coverage proving a UNIX backend is probed through AF_UNIX rather than the identity IP address.
  • Runtime idempotence coverage proving an identical AddCluster with a probe port keeps an unhealthy backend and its failure counters unchanged.
  • Four end-to-end probe-port scenarios across TCP and HTTP modes, plus the DNS-expanded UNIX-backend end-to-end scenario.
  • Focused command/library health-check, worker refusal and stale-incarnation tests.
  • cargo build --workspace --all-targets --locked.
  • cargo clippy -p sozu -p sozu-command-lib --all-targets -- -D warnings.
  • cargo +nightly fmt --all -- --check, git diff --check, and the documentation citation checker against the PR base.

An independent final review of the complete integrated source returned CLEAN.

HealthCheckConfig gains an optional probe port (tag 9). When set, HTTP and TCP probes dial the backend's IP with that port, and the HTTP probe names the probed address in Host (h2c :authority). Unset keeps today's behaviour; a peer that predates the field ignores it. UDP clusters already have UdpHealthConfig.tcp_port.

Validation bounds the port to 1..=65535. The TOML file config, the CLI (cluster health-check set --port), the health-check list output and the docs carry it.

Signed-off-by: Florentin Dubois <[email protected]>
@FlorentinDUBOIS
FlorentinDUBOIS marked this pull request as ready for review October 15, 2026 21:10
@FlorentinDUBOIS
FlorentinDUBOIS merged commit 7852202 into main Oct 16, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant