feat(health): /healthz + /readyz + gRPC health for container deploys#62
Merged
Merged
Conversation
…ploys Adds first-class liveness/readiness for Docker/Kubernetes deployment. - pkg/health: process-wide readiness flag + HTTP handlers. /healthz is liveness (200 once the server is up); /readyz is readiness (200 only after the daemon passes its DestinationReady + netlinkers-up gate, 503 otherwise and on shutdown). Registered on the existing metrics listener. - gRPC: register the standard grpc.health.v1 service on the gRPC port, starting NOT_SERVING and flipping to SERVING on the same readiness condition (for native k8s gRPC probes). - The poller flips readiness (x.setReady) once it passes the DestinationReady gate — the moment xtcp2 starts polling — and back on return; setReady drives both the HTTP flag and the gRPC status from one place. - Bump goVendorHash for the new google.golang.org/grpc/health import. - Tests: pkg/health handlers via httptest; docs/observability.md section. No new flags — the endpoints are always on, on the existing listeners. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class liveness / readiness so xtcp2 is easy to run under Docker and Kubernetes.
What
pkg/health— a process-wide readiness flag + HTTP handlers, served on the existing metrics listener:/healthz— liveness:200as soon as the server is up (k8slivenessProbe)./readyz— readiness:200only after the daemon passes itsDestinationReady+ netlinkers-up gate (i.e. it's actually polling),503before that and during shutdown (k8sreadinessProbe/startupProbe).grpc.health.v1service on the gRPC port, startingNOT_SERVINGand flipping toSERVINGon the same readiness condition (native k8s gRPC probes).x.setReady) the moment it passes theDestinationReadygate, and back on return;setReadydrives the HTTP flag and the gRPC status together.goVendorHashfor the newgoogle.golang.org/grpc/healthimport.No new flags — the endpoints are always on, on the existing listeners.
Verification
Readiness reflects real daemon state (destination initialised + netlinkers started), so an orchestrator holds traffic/rollout until xtcp2 is genuinely collecting — not merely that the process is up.
🤖 Generated with Claude Code