fix(observability-proxy): end silent tails before the Gateway does

Behind a Cilium Gateway, Envoy resets a stream that carries no data for
300s, the default stream idle timeout, and the proxy's own tail idle
limit was the same 5m. A tail that went quiet could then be cut by
Envoy rather than ended by the proxy, which the client sees as a reset
stream instead of a finished response. The HTTPRoute cannot raise
Envoy's limit, so the proxy ends a silent tail a little earlier.

Assisted-by: LLM
Signed-off-by: Maxim Belyy <maximbel2003@gmail.com>
This commit is contained in:
Maxim Belyy authored and ZverGuy committed 2026-11-10 18:32:42 +07:00
1 parent 773a3a96d3
commit d21d9de641
5 files changed
+20 -4

No files matched your search

@@ -38,6 +38,10 @@ spec:
- --cluster-domain={{ $clusterDomain }}
- --root-tenant={{ .Values.observabilityProxy.rootTenant }}
- --auth-cache-ttl={{ .Values.observabilityProxy.authCacheTTL }}
{{- /* Below the 300s stream idle timeout of a Cilium Gateway, so a
published tail that stops sending lines is ended by the proxy,
not reset by Envoy. */}}
- --tail-idle-timeout=4m30s
ports:
- name: http
containerPort: 8080
@@ -22,7 +22,9 @@ spec:
port: 80
{{- /* Without a request timeout Cilium leaves Envoy's 15s route default
in place, which would cut every tail. The proxy bounds each
request itself, so the route sets none. */}}
request itself, so the route disables it. Envoy's 300s stream
idle timeout still applies; the proxy's tail idle limit stays
below it (see deployment.yaml). */}}
timeouts:
request: 0s
{{- end }}
@@ -25,8 +25,9 @@ metadata:
in batches. */}}
nginx.ingress.kubernetes.io/proxy-buffering: "off"
{{- /* The controller default is 10s. The longest silence the proxy
allows is a tail with no new line for --tail-idle-timeout (5m),
after which it ends the response itself. */}}
allows is a tail with no new line for --tail-idle-timeout (4m30s),
after which it ends the response itself; before the first byte
the token and access reviews may add up to --request-timeout (1m). */}}
nginx.ingress.kubernetes.io/proxy-read-timeout: "360"
spec:
ingressClassName: {{ $exposeIngress }}
@@ -40,6 +40,15 @@ tests:
path: spec.template.spec.containers[0].args
content: --auth-cache-ttl=10s
# Envoy behind a Cilium Gateway resets a stream after 300s without data
# (envoy.streamIdleTimeoutDurationSeconds), so a silent tail has to be
# ended by the proxy first, or the client sees a reset instead of an end.
- it: ends a silent tail before the Gateway stream idle timeout
asserts:
- contains:
path: spec.template.spec.containers[0].args
content: --tail-idle-timeout=4m30s
- it: falls back to cozy.local when the platform passes no cluster domain
asserts:
- contains:
@@ -3,7 +3,7 @@ suite: observability-proxy public endpoint
# Kubernetes bearer token, so the route must pass Authorization and the
# /apis/... path through untouched, and must not end a request before the
# proxy does: a non-tail request may take up to --request-timeout (1m), and
# a tail may stay silent up to --tail-idle-timeout (5m). Whole objects are
# a tail may stay silent up to --tail-idle-timeout (4m30s). Whole objects are
# compared rather than single keys, so an annotation or a field that should
# not be there fails the test too.
templates: