Skip to content

BackendTLSPolicySANValidation conformance test failing on main since at least Aug 3 #9687

Open

Description

@kadircanyildirm-crypto

Description:

TestGatewayAPIConformance/BackendTLSPolicySANValidation has been failing on every main run I checked, going back to at least 2026-08-03. Every PR inherits the failure, so red CI is currently hard to read.

Main runs, all with the same failing test:

run date conformance jobs failing on this test
31067661691 08-06 3
31064863693 08-06 2
31059844487 08-06 1
30817198225 08-03 2

The failure splits cleanly by expectation:

--- FAIL: .../valid_BackendTLSPolicy_containing_dns_SAN_should_succeed    (30.00s)
--- PASS: .../mismatched_dns_SAN_should_return_an_HTTP_error
--- FAIL: .../valid_BackendTLSPolicy_containing_uri_SAN_should_succeed    (30.01s)
--- PASS: .../mismatched_uri_SAN_should_return_an_HTTP_error
--- FAIL: .../valid_BackendTLSPolicy_containing_multi_SAN_should_succeed  (30.00s)
--- PASS: .../mismatched_multi_SAN_should_return_an_HTTP_error

Every "valid SAN should succeed" case gets 503 for the whole 30s window (30/30 attempts on both /backendtlspolicy-san-dns and /backendtlspolicy-san-uri):

expected status code to be one of [200], got 503

The mismatch cases pass because they only assert that the request fails, so they would also pass if SAN validation rejected everything.

The BackendTLSPolicy e2e tests look affected too — TestE2E/HTTPRouteMixedProtocols (which applies policy-btls and backend-tls-ca) and TestE2E/HTTPRouteMixedBackends are failing on main and on PR branches in the same runs.

I have not root-caused it, so I am not sure whether the upstream TLS handshake or the SAN matcher is at fault. Filing this so it is tracked, and happy to dig in if nobody is on it already.

Activity

  1. added
    help wanted
    on Aug 13, 2026
  2. zirain commented on Aug 13, 2026

    @zirain
    Member

    @kkk777-7 Do you think may be associated with #9221?

  3. kkk777-7 commented on Aug 13, 2026

    @kkk777-7
    Member

    I don't think there is a relationship. 🤔

  4. zirain commented on Aug 13, 2026

    @zirain
    Member

    it's odd that always return 503.

  5. kadircanyildirm-crypto commented on Aug 13, 2026

    @kadircanyildirm-crypto
    Author

    A few things I found while looking at this again:

    The 503 has an empty body (Content-Length: 0), and it is the same on all 30 attempts for all three valid paths — latest example is today's main run, where this is the only failing test in that job.

    The three mismatch cases use MakeRequestAndExpectFailure, so a 503 satisfies them too. The test cannot tell "SAN rejected the connection" apart from "the whole route is 503ing", so it may well be all six paths returning the same thing.

    It is also flaky rather than constant — about one conformance matrix job per run, and the entry that hits it moves around, so the same commit is green in the other seven jobs.

    And there is an older, different failure under the same test name: runs 28554318658 (1 Jul) and 28735397251 (5 Jul) fail only /backendtlspolicy-san-uri and return 400, not 503. Both predate #9221, which fits @kkk777-7's read.

    Next I will pull the envoy-gateway artifact from a failing run and check whether the six SAN clusters and their endpoints are in the config dump.

  6. kadircanyildirm-crypto commented on Aug 13, 2026

    @kadircanyildirm-crypto
    Author

    @zirain I think the 503 is ours by design, and not a TLS failure at all.

    When a backend has no ready endpoints, NoEndpoints > 0 switches the route to a weighted action (xds.go#L1116), the endpoint-less setting is dropped from the weighted list, and its weight goes to invalid-backend-cluster (route.go#L358) with cluster_not_found_response_code: 503 (route.go#L399). We never create that cluster, so Envoy replies cluster_not_found — a 503 with an empty body, which is exactly what the client logs: 503 0 HTTP/1.1 map[Content-Length:[0] ...].

    So in the failing job Envoy was serving a config where those Services had no endpoints, for the whole 30s window. The SAN part looks like a red herring — the same three paths would 503 with any BackendTLSPolicy.

    What I cannot explain yet is why it never recovered. The Services select the tls-backend pods that are already running, so the EndpointSlices should be there almost immediately.

  7. zirain commented on Aug 13, 2026

    @zirain
    Member

    yeah, why I assumed #9221 maybe the cause.

  8. kadircanyildirm-crypto commented on Aug 13, 2026

    @kadircanyildirm-crypto
    Author

    Bisected the 503 variant, and it points somewhere else.

    I scanned every failing conformance job on main from 9 Jul to now. From 9 Jul through 30 Jul the SAN failure is always the 400-on-/backendtlspolicy-san-uri one, never a 503. The first 503 run is 30795904904 (3 Aug, 48986089), and the last run before it with all eight conformance jobs green is 30776472921 (4061d834). From 3 Aug on it shows up in most runs.

    The one functional change in that window is #9532, which sets initial_fetch_timeout: 0 in makeConfigSource(). That helper is shared by RDS and by every SDS secret config, including the upstream validation context we build for BackendTLSPolicy (translator.go#L1305). In Envoy 0 means wait forever rather than the 15s default, so a cluster whose SDS secret does not arrive stays warming and never becomes active — and a route to a cluster that is not active gets cluster_not_found, which is the empty-body 503. It also fits that only these tests break: they are the ones creating new clusters with an SDS validation context.

    #9532's own run had conformance skipped, so 30795904904 was the first run to exercise it. I have not reproduced this locally yet, so treat it as a lead rather than a conclusion.

  9. kadircanyildirm-crypto commented on Aug 13, 2026

    @kadircanyildirm-crypto
    Author

    Confirmed the link to #9532. The commit that added initialFetchTimeout: 0s to the BackendTLSPolicy validation-context SDS config is 4ce3a07f, and you can see it landing in the golden output at backend-tls-settings.clusters.yaml#L53-L58.

    That PR closed #9373, which was about the warning initial fetch timed out for ...v3.Secret, so the "the secret does not reach Envoy in time" condition already existed well before 3 Aug — what #9532 changed is what happens when it occurs. With the 15s default the fetch eventually timed out and the cluster left the warming state; with 0 it never leaves it, so every request routed there gets cluster_not_found, which is the empty-body 503, and it cannot recover. That fits @zirain's "it's odd that always return 503" and all 30 attempts over the 30s window failing identically.

    A plain revert would just bring the #9373 warning back, so the question I would ask next is why the secret is late for these clusters at all — the timeout setting only decides which failure you end up seeing.

  10. zirain commented on Aug 20, 2026

    @zirain
    Member

    @kadircanyildirm-crypto after debugging this for a while I have same thought with you, I think #9532 cause this.

    Thinking about following push queue:

    1. CDS
    2. CDS+SDS+EDS
    3. CDS2

    After 1 is pushed to the envoy, 2 and 3 are coalesced(only 3 pushed to envoy), resulting in the sds not being pushed, the CDS will be blocked.

    same-namespace-6f6866db8d-jnfx2.json

  11. zaremjan commented on Aug 21, 2026

    @zaremjan

    I think this timeout change breaks other places as well.

    After updating from 1.8 to 1.9 I'm seeing occasional outages of routes secured by OIDC, usually after control plane was redeployed. Envoy Proxies respond with 503 and %RESPONSE_CODE_DETAILS% in the access logs is OAuth2_secrets_are_not_ready.

    It does not recover on its own, restarting Envoy Proxies fixes it.

  12. kadircanyildirm-crypto commented on Aug 21, 2026

    @kadircanyildirm-crypto
    Author

    @zaremjan that looks like the same code path rather than a separate bug.

    The OAuth2 filter's TokenSecret and HmacSecret are built with the same makeConfigSource() helper #9532 changed (oidc.go#L156-L165), so initial_fetch_timeout: 0 applies verbatim to your OIDC client secret and HMAC secret. 4ce3a07f is in v1.9.0 and in no v1.8.x tag, which matches your upgrade exactly.

    And makeConfigSource() is not BackendTLSPolicy-specific — ten call sites get initial_fetch_timeout: 0 on main today: RDS route config, downstream TLS certificates (HTTP/3, TCP), downstream mTLS CA, OAuth2 client secret and HMAC secret, CredentialInjector credential, rate limit service client cert, and the BackendTLSPolicy validation context and client cert. The conformance failure is the case we happen to have a test for, not the boundary of the problem.

    I would not assume both symptoms share an Envoy mechanism, though. Ours is cluster_not_found — the cluster never leaves warming. Yours is OAuth2_secrets_are_not_ready, so the listener is serving and the filter is rejecting on an empty secret slot. Whether a non-zero timeout would make your case actually recover, rather than just fail differently, is not obvious to me — on init-fetch timeout Envoy marks the init target ready with the secret still absent. If you can grab config_dump?resource=dynamic_warming_secrets and stats | grep 'sds\.' off a stuck proxy, that would settle it, and also show whether the control plane pushed that secret at all — which is where @zirain's coalescing analysis points.

    Either way, "does not recover on its own" is new in v1.9.0 and now spans OIDC, BackendTLSPolicy, downstream TLS and the rate limit client cert. Even if the real fix is server-side, a finite initial_fetch_timeout on release/v1.9 seems worth it as a stopgap: it brings back the #9373 warning, but a log line beats a proxy serving 503s until someone restarts it.

  13. vishals-3 commented on Sep 23, 2026

    @vishals-3
    Contributor

    This looks fixed — #9532 was reverted by #9747 (3b96b298, 23 Aug), which is on main. makeConfigSource() no longer sets initial_fetch_timeout at all, so the 0 = wait-forever behaviour @kadircanyildirm-crypto and @zirain traced is gone.

    Conformance on recent main runs:

    run conformance jobs failing
    34010341014 (06 Sep) 10 0
    33956918293 (05 Sep) 10 0
    33860459754 (04 Sep) 10 1
    33850549816 (04 Sep) 10 1

    The two most recent are fully green on conformance, and SANValidation does not appear in the remaining 04 Sep failure. main is still red, but on e2e-test jobs rather than conformance.

    Worth closing, since the issue's own complaint was that red CI is hard to read — an open issue saying main is broken has the same effect once it isn't.

    Two things that may deserve their own issues rather than dying with this one:

    • @zaremjan's OIDC OAuth2_secrets_are_not_ready outages on 1.9.0. The revert is on main, but if release/v1.9 did not get it, upgraded clusters are still exposed.
    • @zirain's push-coalescing analysis (CDS, then CDS+SDS+EDS coalesced into CDS2 so SDS is never pushed). As @kadircanyildirm-crypto put it, the timeout only decided which failure you saw — if the secret is genuinely never pushed, that is still there, just no longer unrecoverable.
  14. vishals-3 commented on Sep 23, 2026

    @vishals-3
    Contributor

    Following up on my own question about release/v1.9 — I checked, and it is covered, so there is no cherry-pick needed.

    v1.9.0  listener.go sets InitialFetchTimeout  -> 1 occurrence
    v1.9.1  listener.go sets InitialFetchTimeout  -> 0 occurrences
    

    release/v1.9 did ship #9532 (4ce3a07f is an ancestor), so v1.9.0 has the bug. It was removed on the branch by c30c739f — "[release/v1.9] cherry pick for v1.9.1 (#9872)" — and that commit is an ancestor of the v1.9.1 tag.

    @zaremjan so the concrete remedy for your OIDC outages is upgrade to v1.9.1. That matches your symptom exactly: 4ce3a07f is in v1.9.0 and in no v1.8.x tag, which is why 1.8 was fine, and it is gone again in v1.9.1.

    That leaves @zirain's push-coalescing question as the only thing here without a resolution, and it is independent of the timeout — worth its own issue if it is still reproducible, since a secret that is never pushed is a problem regardless of what the fetch timeout is set to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testinghelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions