mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
Proxies only serve /healthz, which reports whether the node has a tailnet IP, so it can't back a liveness or readiness probe. When TS_ENABLE_HEALTH_CHECK is set, containerboot now also serves /livez, which fails only when tailscaled stops answering LocalAPI, and /readyz, which passes once the node has tailnet IPs and, with TS_SERVE_CONFIG set, has applied the serve config and has a cert for each HTTPS-only Tailscale Service it advertises. Certs are checked through the read-only cert-status endpoint so the probe never triggers issuance. An expired or unreadable cert counts as present, as failing readiness on it would stop a StatefulSet rollout before it reaches the replica that renews certs. Updates tailscale/corp#38175 Signed-off-by: chaosinthecrd <[email protected]>
23 lines
610 B
Go
23 lines
610 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !plan9
|
|
|
|
package health
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"tailscale.com/types/logger"
|
|
)
|
|
|
|
// RegisterReadyzHandlers registers a readiness probe at /readyz, so each part
|
|
// of the proxy can keep the Pod out of its Service's endpoints until it can
|
|
// carry traffic. Register every check on the returned Probe before serving
|
|
// mux, as a Probe with no checks passes.
|
|
func RegisterReadyzHandlers(mux *http.ServeMux, logf logger.Logf) *Probe {
|
|
p := &Probe{name: "readyz", logf: logf}
|
|
mux.Handle("GET /readyz", p)
|
|
return p
|
|
}
|