From ca6fbae1088ddf2a03a7c590b7ed76ef4dc803be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=81=D0=B8=D0=BB=D1=8C=D0=B5=D0=B2=20=D0=9D?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Mon, 16 Nov 2026 12:07:47 +0300 Subject: [PATCH] Keep liveness reachable through mTLS when dependency readiness fails --- infra/haproxy.cfg | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/infra/haproxy.cfg b/infra/haproxy.cfg index a86b845..94de4ea 100644 --- a/infra/haproxy.cfg +++ b/infra/haproxy.cfg @@ -27,7 +27,9 @@ resolvers docker frontend public bind :8443 ssl crt /run/tls/identity/combined.pem http-request set-var(txn.lb_request_id) uuid() - http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No ready API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' if { nbsrv(apis) eq 0 } + http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No ready API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { nbsrv(apis) eq 0 } !{ path /health/live } + http-request return status 503 content-type application/json lf-string '{"error":{"code":"unavailable","message":"No live API","request_id":"%[var(txn.lb_request_id)]"}}' hdr X-Request-Id '%[var(txn.lb_request_id)]' hdr X-Instance-Id ingress if { path /health/live } { nbsrv(live_apis) eq 0 } + use_backend live_apis if { path /health/live } default_backend apis backend apis @@ -36,3 +38,12 @@ backend apis http-check expect status 200 default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none + +# Liveness remains observable when a dependency seals and readiness is false. +# This backend exposes only the exact liveness path, still through LB mTLS. +backend live_apis + balance roundrobin + option httpchk GET /health/live + http-check expect status 200 + default-server inter 1s fastinter 500ms downinter 1s fall 2 rise 2 + server-template api 1-8 api:9443 ssl verify required ca-file /run/tls/ca.pem crt /run/tls/identity/combined.pem verifyhost api sni str(api) check check-sni api resolvers docker resolve-prefer ipv4 init-addr libc,none