HDDS-16360. Add liveness and readiness health endpoints to S3 Gateway - #11224
Open
yandrey321 wants to merge 2 commits into
Open
HDDS-16360. Add liveness and readiness health endpoints to S3 Gateway#11224yandrey321 wants to merge 2 commits into
yandrey321 wants to merge 2 commits into
Conversation
Contributor
Author
|
@jojochuang could you please take a look? |
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.
What changes were proposed in this pull request?
Adds two unauthenticated HTTP health endpoints to the S3 Gateway, served on the
web admin server (default port
19878), separate from the S3 data listener(
9878):GET /health/live→200 OKwhile the gateway process is up and its webadmin server can serve requests. It does not check OM reachability.
GET /health/ready→200 READYonly when the gateway can reach OM, and503 NOT READYduring startup or while OM is unreachable.Readiness is backed by
S3GatewayReadinessProbe, a single background threadthat periodically probes OM (
getServiceInfo) and stores the result in avolatile flag. The servlet only reads that flag, so
/health/readyalwaysresponds immediately — no OM RPC on the request path — and a load balancer
polling it can never be blocked by a slow or unreachable OM. The probe runs its
OM call on a separate single-thread executor with an enforced deadline, so a
hung call flips the gateway to "not ready" rather than wedging the scheduler. It
owns a dedicated
OzoneClient(created viaOzoneClientCache.createClient) soit exercises the same OM transport the gateway serves with, with S3 auth
disabled and a bounded OM RPC timeout.
The endpoints are registered with
addInternalServlet, so no authenticationfilter is mapped to them and they remain reachable by a load balancer without
Kerberos/SPNEGO, including in secure mode. Because they live on the admin port,
they cannot collide with S3 bucket names or require SigV4 signing.
Wiring updated to use the new endpoints:
livenessProbenow points at/health/live(was
/) and areadinessProbeon/health/readyis added.compose/commonandcompose/ozonesecure-ha) health-checkthe readiness endpoint (
GET /health/ready, expect200) withinter 2s rise 1so backends are routed to promptly once ready.compose/testlib.shgainswait_for_s3g_ready(), invoked fromstart_docker_env, so acceptance tests don't start issuing S3 requests whileHAProxy still has all backends
DOWN(which would return503). It onlywaits when the multi-instance HAProxy setup (
s3g1/s3g2/s3g3) is present.Configuration
New
ozone.s3g.health-check.*config group (S3GatewayHealthCheckConfig):ozone.s3g.health-check.enabledtrue/health/liveand/health/readyendpoints.ozone.s3g.health-check.probe.interval10sozone.s3g.health-check.probe.timeout10sWhy are the changes needed?
When S3 Gateway is horizontally scaled behind a load balancer, the balancer
needs an HTTP health check to route S3 traffic only to gateways that can
actually serve it. The existing admin server had no dedicated liveness/readiness
endpoints; the k8s liveness probe hit
/and there was no readiness signal atall, so traffic could be sent to a gateway that is up but cannot reach OM.
Generated-by: Claude Code (Claude Opus 4.8)
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16360
How was this patch tested?
TestS3GatewayLivenessServlet— liveness returns200 OK.TestS3GatewayHealthCheck— readiness reflects the probe flag (200 READYvs
503 NOT READY) and endpoints are gated byhealth-check.enabled.smoketest/s3/health.robotexercises both endpoints;compose/ozone/test.shruns it.(registered via
addInternalServlet).