Repository navigation
fix: scope merged cluster settings by backend protocol - #10016
Merged
kkk777-7 merged 2 commits intoSep 25, 2026
Merged
Conversation
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10016 +/- ##
=======================================
Coverage 81.31% 81.31%
=======================================
Files 264 264
Lines 40970 40990 +20
=======================================
+ Hits 33313 33331 +18
- Misses 7656 7658 +2
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
zirain
approved these changes
Sep 24, 2026
jukie
approved these changes
Sep 24, 2026
kkk777-7
added a commit
that referenced
this pull request
Sep 28, 2026
* fix(luavalidator): block getfenv/setfenv/newproxy/module in the Lua security sandbox (#9743) * fix(luavalidator): block getfenv/setfenv/newproxy/module in the Lua sandbox getfenv/setfenv/newproxy/module were not in the blocklist. getfenv(0) returns the global table regardless of `_G = nil`, so that line's comment is inaccurate. No escape is reachable today (io/os originals stay in upvalues, debug is nil), so this is defense-in-depth. Signed-off-by: kanywst <niwatakuma@icloud.com> * docs: add release note for Lua sandbox env hardening Signed-off-by: kanywst <niwatakuma@icloud.com> * docs: note the Lua sandbox hardening as a breaking change Signed-off-by: kanywst <niwatakuma@icloud.com> --------- Signed-off-by: kanywst <niwatakuma@icloud.com> Co-authored-by: Rudrakh Panigrahi <rudrakh97@gmail.com> * fix(ratelimit): apply priorityClassName to the rate limit pod (#9898) rateLimitDeployment.pod.priorityClassName was accepted in EnvoyGateway config but never copied onto the managed Deployment pod spec, so the rate limit pod ignored the configured PriorityClass. Set it the same way the proxy Deployment already does. Fixes #9897 Signed-off-by: Vijay Pal <vijay.pal@nutanix.com> * fix: apply maxDynamicDescriptors at route level (#9974) * fix: apply maxDynamicDescriptors at route level Envoy Gateway sets max_dynamic_descriptors to 10000 only on the HCM-level local_ratelimit filter, which carries no descriptors. The real configuration lives in each route's typed_per_filter_config, and Envoy resolves that per-route config as a whole without inheriting anything from the HCM filter, so every route-level limiter fell back to Envoy's default of 20. A Distinct rule (per client IP, per header value, per query parameter) therefore tracked only the 20 most recently seen values: the 21st evicted the oldest bucket, and an evicted client came back with a full bucket. That made per-client limits on a public listener a coarse layer rather than a bound. Set the same limit on the route-level config, where the wildcard descriptors actually live, and share the constant between both sites. Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> * test(ratelimit): cover and document dynamic bucket retention Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> * chore: number the local rate limit release note Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> * test(ratelimit): pin the limiter headers on 429 CompareRoundTrip compares response headers only for 200 and 204, so the retention subtest's final 429 was attributed by status alone. Assert x-ratelimit-limit and x-ratelimit-remaining on the captured response to tie the rejection to the original user's exhausted bucket. Also reword the constant's comment: the capacity applies per wildcard descriptor in each route configuration, and entries are allocated on demand. Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> --------- Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> Co-authored-by: zirain <zirain2009@gmail.com> * fix(translator): match SNI on every TCP filter chain (#10011) * Revert "fix(tcp): add SNI-based filter chain matching for TLS passthrough empty routes (#8521)" This reverts commit c11f0c2. emitting identical EmptyCluster filter chains -- by collapsing the placeholder chains into a single shared one, rather than by giving them distinct matchers. Collapsing only helps against another placeholder: it does nothing when the colliding chain belongs to a different listener, which is why #9341 and #9516 still reproduce. Its own commit message describes adding SNI matching, but the merged change carries none. Restore the per-listener empty route. The commits that follow add the SNI match the placeholder chains actually need, which keeps them unique on their own. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix(translator): match SNI on every TCP filter chain Filter chains on a shared xDS listener must each have a distinct match or Envoy rejects the listener and stops accepting updates to it. Placeholder chains for route-less listeners had no match at all, so one sharing a port with a wildcard HTTPS listener produced two `{}` matchers and a NACK. Carry the Gateway listener hostname on the TCP IR listener, for TLS protocol listeners only since TCP ignores hostnames, and resolve the SNI once in addXdsTCPFilterChain, falling back to that hostname whenever the route carries none of its own. Every TCP filter chain is then matched the same way and the placeholder needs no special case. Reinstate the #7866 regression test dropped by the revert, with each listener given a distinct hostname -- listeners sharing a port with identical hostnames are rejected with HostnameConflict before translation, so this is what the Gateway API layer actually emits. It now asserts three chains with three distinct serverNames rather than one shared chain. Co-authored-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> Signed-off-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * clean up Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix(translator): name the placeholder filter chain after its listener The placeholder chain for a route-less TCP listener was named after the EmptyCluster it points at, which reads as a cluster in a config dump and goes stale if the placeholder ever targets something else. Name it after the listener that owns it instead, with a /no-routes suffix saying why the chain exists. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * test: include SNI hostname in merged gateway fixture Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> Co-authored-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> * fix(gatewayapi): conflict HTTPS and TLS listeners sharing a hostname when gateways are merged (#10013) validateConflictedMergedListeners keys on the listener protocol verbatim, so an HTTPS listener and a TLS listener on the same port with the same hostname land in different buckets and are both accepted. They cannot both be served: listeners sharing a port are told apart by SNI, and here the SNI is the same. Envoy ends up with two filter chains carrying an identical server_names match and rejects the listener, along with every update to it that follows. Key on the protocol class instead, which puts HTTPS and TLS together, so the second listener is marked Conflicted with HostnameConflict. This is what validateConflictedHostnameListeners already does within a single Gateway; merged Gateways were the only path that skipped the check. Also route the conflict through setConflictedConditions rather than setting the condition directly. Every other conflict path already uses it, and it is what sets Accepted=False and Programmed=False on a ListenerSet listener -- without it a conflicted ListenerSet entry reports no Accepted condition at all and a generic ListenersNotValid reason for Programmed. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix: scope merged cluster settings by backend protocol (#10016) * fix: scope merged cluster settings by backend protocol Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * rename release note Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix: marshal xDS typed_config deterministically to avoid equivalent-resource churn (#10019) * fix: marshal xDS typed_config deterministically to avoid equivalent-resource churn ToAnyWithValidation wrapped every filter typed_config via anypb.New, which uses the default non-deterministic marshaler. Proto map fields (an access log's json_format, JWT providers, filter metadata) then serialize in a random key order on each translation, so semantically unchanged resources are emitted with different bytes and republished on every reconcile. Marshal deterministically via anypb.MarshalFrom so map keys serialize in a stable order. Add a regression test, since the golden xDS tests compare protojson output (which re-sorts map keys) and cannot catch this. Signed-off-by: nguyenptk <nguyenptk@gmail.com> * docs: add release note for deterministic xDS marshaling fix Signed-off-by: nguyenptk <nguyenptk@gmail.com> --------- Signed-off-by: nguyenptk <nguyenptk@gmail.com> * fix: accept equal-preference cipher groups in TLS settings (#10050) The cipher validation added in v1.8.0 compares each entry of the cipher list against the set of supported cipher names as a whole string. That rejects BoringSSL equal-preference groups such as "[ECDHE-ECDSA-AES128-GCM-SHA256|ECDHE-ECDSA-CHACHA20-POLY1305]", which Envoy accepts and which let the client's own preference break the tie between equally preferred ciphers. This includes the default cipher list documented on the ciphers field itself, so copying the documented defaults into a ClientTrafficPolicy left it not accepted. Unwrap group entries and validate each member, rejecting malformed groups (unclosed, empty, nested) and a separator used outside a group. Fixes #9679 Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Co-authored-by: zirain <zirain2009@gmail.com> * fix(gatewayapi): allow consistent hash with merge backends (#10052) * feat(gatewayapi): allow consistent hash with merge backends Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix: refresh consistent hash merge fixtures and cleanup Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix: clarify consistent hash merge regression coverage and release note Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * chore: remove unused BTPLoadBalancerIndex The gateway-level ConsistentHash check in weightedRuleBackendsMustBeInOneCluster was its only consumer, and that check is gone now that consistent hashing works with merged backends. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * test(xds): cover consistent hash with merged backend clusters Feed the IR from the gatewayapi mergebackends consistent-hash fixture through the xDS translator, checking that shared clusters get the Maglev policy and hash config and the weighted route keeps its hash policy with use_hash_policy. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> --------- Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> * perf: store extension server resources centrally (#10071) * perf: store extension server resources centrally Signed-off-by: zirain <zirain2009@gmail.com> * nit Signed-off-by: zirain <zirain2009@gmail.com> * more tests Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: zirain <zirain2009@gmail.com> * perf: store upstream CA bundles once per gateway (#10072) * perf: share immutable TLS certificate bytes across IR copies A heap profile of a gateway whose backends validate against a shared CA had 4.75 GB of a 7.45 GB live heap in duplicated certificate bytes. Two multipliers stack: every DestinationSetting gets its own copy of the CA bundle, and the watchable map deep copies the whole ir.Xds once per store and once per subscriber, so each bundle was held once per destination per copy. The bytes are already immutable once translation has produced them. The translator aliases them straight out of the Secret, and the xDS translator only reads them into protobuf InlineBytes, so the copy in the generated deep-copy functions bought nothing. Hand-write DeepCopyInto for TLSCACertificate, TLSCertificate and TLSCrl so a copy shares those slices. controller-gen omits a generated DeepCopyInto when the type already has one, so the generated DeepCopy wrappers and every caller stay as they are. Intern the assembled CA bundle per translation so destinations referencing the same CA share one backing array as well. Deep copying an IR with 1000 destinations sharing a 22KB CA bundle drops from 25.6 MB and 2.7 ms to 1.1 MB and 0.27 ms. Translation allocation on the same shape drops about 29%. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * polish Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * test: build the benchmark CA bundle instead of pasting it The bundle was one certificate repeated twenty times inline in the ConfigMap YAML, which cost about 400 unreadable lines and defined the bundle twice, so nothing kept the translation benchmark and the deep-copy benchmark measuring the same bytes. Build it from a single constant instead. Also name the release note after the PR rather than the issue. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * perf: store upstream CA bundles centrally instead of sharing their memory Sharing the certificate bytes between IR copies kept the deep copy at the watchable boundary from duplicating them, but it also meant a byte slice reachable from several snapshots at once, which is harder to reason about and leaves an append on one copy visible to another. Store the bundles centrally instead, the way extension server resources are stored, so each copy stays self-contained. Xds.CACertificates holds one CACertificateEntry per distinct bundle, addressed by a digest of its bytes, and TLSCACertificate carries that digest rather than its own copy. A reference keeps its own Name, so the xDS secret name is unchanged and Envoy sees exactly what it saw before. Where no gateway IR is in scope to register against, such as the ext service and telemetry paths, the bytes stay on the reference and resolution falls back to them. Addressing by content rather than by the owning policy matters because BackendTLSPolicy cannot reference across namespaces, so a cluster trusting one corporate CA is forced to copy it per namespace. Keying on the policy would leave every one of those copies in place. Deep copying an IR with 1000 destinations, each with its own policy trusting the same CA, drops from 25.6 MB and 2.1 ms to 1.1 MB and 0.28 ms. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix: use the full digest to content-address CA bundles The digest was cut to its first 64 bits, and a match reused the existing entry without comparing the bytes behind it. Two bundles on one gateway sharing that prefix would silently give the second destination the first bundle as its trusted CA. A gateway can carry bundles from tenants that do not trust each other, so the truncation is not worth the shorter name. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * fix: key the resolved CA cache by the resource, not its secret name A Backend and a BackendTLSPolicy both name their CA secret <name>/<namespace>-ca, so one of each sharing a name in a namespace produced the same cache key. The cache was also written from the merged config, which cannot tell which of the two the CA came from. A route to the Backend translated first therefore let the policy skip reading its own refs and adopt the Backend's CA. Key the cache by the resource's kind, namespace and name instead, and write it where the CA is resolved rather than after the merge. Cache the digest rather than the entry, so a destination rejected before its bundle is registered leaves nothing for a later lookup to reuse. The Backend path now takes the same shortcut the policy path already had, which is what makes the kind in the key meaningful. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> --------- Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: zirain <zirain2009@gmail.com> Co-authored-by: zirain <zirain2009@gmail.com> * fix(translator): compute GeoIP header removals once per listener (#10107) * [envoy-gateway] Reuse listener GeoIP header removals [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> * [envoy-gateway] Add GeoIP translation performance release note [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> --------- Signed-off-by: Cooper Gamble <cooper@openai.com> Co-authored-by: zirain <zirain2009@gmail.com> * fix: count UDP proxy sessions in shutdown drain (#10110) fix: count UDP proxy sessions in shutdown drain (#10109) The shutdown manager only summed listener downstream_cx_active, which never includes UDP proxy sessions, so a UDP-only proxy exited as soon as the minimum drain period passed. Also count udp.*.downstream_sess_active. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * test: regenerate the merged consistent-hash cluster golden (#10115) Marking merged backend clusters as route clusters stopped them carrying a cluster-level hash policy, since a route cluster gets its hash policy from the route action instead. The golden was not regenerated at the time, so TestTranslateXds and gen-check fail on main. Consistent hashing is unaffected: the route still carries the source IP hash policy and both clusters keep their maglev load balancing policy. Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> * [cooper-09] fix(jsonpatch): batch JSONPath matches (#10118) * [envoy-gateway] Batch JSONPath matches in one apply [ci changed_files] Signed-off-by: Cooper Gamble <cooper@openai.com> * fix: generate testdata Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> * fix: security fixes (#10130) * security fix: GHSA-gmx8-fhfh-mgjx (#35) Signed-off-by: Guy Daich <guy.daich@sap.com> * fix: check for nil pod-name key in Token Review extra field (#41) Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com> Co-authored-by: Karol Szwaj <karol.szwaj@gmail.com> * fix: allow to disable EnvoyProxy patch with RuntimeFlag (#37) Signed-off-by: zirain <zirain2009@gmail.com> * fix: a panic during shutdown (#33) Signed-off-by: zirain <zirain2009@gmail.com> * release notes Signed-off-by: zirain <zirain2009@gmail.com> * fix PR number Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: Guy Daich <guy.daich@sap.com> Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> Co-authored-by: Guy Daich <guy.daich@sap.com> Co-authored-by: Karol Szwaj <karol.szwaj@gmail.com> * add: envoy proxy warn condition Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> --------- Signed-off-by: kanywst <niwatakuma@icloud.com> Signed-off-by: Vijay Pal <vijay.pal@nutanix.com> Signed-off-by: Andreea Popescu <andreea.popescu@pidginhost.com> Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing (Robin) Zhao <huabing@tetrate.io> Signed-off-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com> Signed-off-by: nguyenptk <nguyenptk@gmail.com> Signed-off-by: zirain <zirain2009@gmail.com> Signed-off-by: Cooper Gamble <cooper@openai.com> Signed-off-by: Guy Daich <guy.daich@sap.com> Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com> Co-authored-by: kt <kanywst12@gmail.com> Co-authored-by: Rudrakh Panigrahi <rudrakh97@gmail.com> Co-authored-by: Vijaypal(NAI) <vijay.pal@nutanix.com> Co-authored-by: andreeapid <andreea.popescu@pidginhost.com> Co-authored-by: zirain <zirain2009@gmail.com> Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com> Co-authored-by: Florian Wiegand <36593900+wiegandf@users.noreply.github.com> Co-authored-by: Nguyên (Harry) <nguyenptk@gmail.com> Co-authored-by: cooper-oai <cooper@openai.com> Co-authored-by: Guy Daich <guy.daich@sap.com> Co-authored-by: Karol Szwaj <karol.szwaj@gmail.com>
muwaqar-cflt
added a commit
to muwaqar/gateway
that referenced
this pull request
Oct 8, 2026
…rotocol processBackendTrafficPolicyForBackend copied the full ClusterTrafficFeatures onto every matching merged cluster regardless of its protocol, so HTTP-only fields (healthCheck, http2, admissionControl, ...) could leak onto a udp_proxy/tcp_proxy cluster. Reuse applyGatewayPolicyToMergedCluster, which already subsets correctly per protocol for the whole-gateway BTP path (added in envoyproxy#10016 for the same bug class). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io>
zhaohuabing
pushed a commit
that referenced
this pull request
Oct 9, 2026
… or Backend directly (merged clusters only) (#9816) * api: add backend-targeted BackendTrafficPolicy CEL validation layer Adds CEL validation rules for backend-targeted (Service/ServiceImport/Backend) BackendTrafficPolicy support: - Extends targetRef/targetRefs group validation to accept multicluster.x-k8s.io and gateway.envoyproxy.io groups for Service, ServiceImport, and Backend kinds - Adds validation requiring mergeType when targeting a backend - Adds validation rejecting route-only fields (rateLimit, faultInjection, useClientProtocol, compression, compressor, responseOverride, httpUpgrade, requestBuffer, telemetry, routingType, retry, bandwidthLimit) when targeting a backend - Adds validation rejecting sectionName on backend targets - Updates mergeType doc comment to reflect support for backend targets - Includes four new test cases covering valid/invalid backend targeting scenarios These changes establish the CEL contract that downstream tasks depend on. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: resolve backend-targeted BackendTrafficPolicy into merged clusters Adds processBackendTrafficPolicyForBackend, wired into ProcessBackendTrafficPolicies, to resolve BackendTrafficPolicies targeting a Service/ServiceImport/Backend: detects conflicting attachments to the same backend, merges with any whole-gateway policy, and writes the resulting traffic features into every already-merged BackendCluster's Traffic field across all gateways. Backends that never resolve to a merged cluster are silently skipped, per Phase 1 scope. Adds the isBackendTrafficPolicyTarget predicate and the backendPolicyKey/backendPolicyKeyFromTarget/backendPolicyKeyFromMetadata helpers used for matching policy targets to BackendCluster metadata. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden fixtures for backend-targeted BackendTrafficPolicy Exercises the full translator pipeline for Service-targeted BackendTrafficPolicy under MergeBackends: standalone, merged with a whole-gateway policy, independent multi-backendRef weighted rules, the silent no-op when a backendRef never merges, and conflict detection between two policies targeting the same backend. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * test: regenerate Helm CRD golden fixtures for backend-target CEL rules make gen-check wasn't run after Task 1's CEL validation changes to BackendTrafficPolicySpec, leaving these golden fixtures stale relative to the new kubebuilder markers. Regenerated via make generate. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: fix status scoping and error handling in backend-targeted BTP Scope the Accepted/Merged ancestor status to the gateways where the policy's target actually matched a BackendCluster, instead of every configured gateway - a policy whose target never resolves anywhere now gets no ancestor status at all. Gate the Merged condition further on whether a real gateway-level BackendTrafficPolicy existed to merge with, since mergeType alone doesn't imply an actual merge happened. Surface buildTrafficFeatures errors via SetTranslationErrorForPolicyAncestors instead of silently skipping the cluster, and trim tf.Timeout's route-scoped members before assigning to bc.Traffic, matching the gateway-level path's precedent. Add a release note for the backend-targeted BackendTrafficPolicy feature. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api,gatewayapi: tighten CEL group/kind pairing and naming, port test/status parity from #8890 Replace independent group and kind allow-lists with a combined group/kind pairing rule for targetRef and targetRefs, matching the fix from the abandoned #8890 (invalid combinations like group: gateway.networking.k8s.io with kind: Service previously passed admission since group and kind were validated independently). Port #8890's comprehensive per-kind CEL test matrix (valid CDS-only fields, reject-all-RDS-fields, sectionName rejection, each across Service/ServiceImport/Backend and targetRef/targetRefs), adapted to also require mergeType per this branch's own rule. Rename isBackendTrafficPolicyTarget to isBackendTargetKind (also #8890's name) - the old name read as checking whether a target is a BackendTrafficPolicy, not whether its kind is a backend kind. Call deprecatedFieldsUsedInBackendTrafficPolicy/ SetDeprecatedFieldsWarningForPolicyAncestors for backend-targeted policies too, matching the other three scopes in this file (and #8890) - the helper already exists and is already used uniformly elsewhere. Add a non-generic MergedConditionMessage naming the actual gateway policy in the Merged condition, replacing the static placeholder string; #8890's version was generic over multiple merged-with policies (a shape this branch's one-backend-to-one-gateway merge never has), so this only keeps the single fallback case it actually needs. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: simplify matchedGWs tracking in processBackendTrafficPolicyForBackend gwPolicy is looked up once per gateway, before the inner BackendClusters loop, and never changes within that loop - so every write to matchedGWs[gwNN] for a given gateway assigns the same value regardless of which matching cluster triggered it. The nil-guard branch was dead complexity protecting against an overwrite that could never happen; collapsing it to an unconditional assignment is behavior-preserving (verified via a full golden-fixture regeneration producing zero diff). Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden fixtures for backend-target coverage gaps found vs #8890 Three scenarios from #8890's fixture set were phase-1-relevant but not exercised by any existing fixture here: - partial-coverage: a rule with two backendRefs where only one has a backend-targeted policy - proves the untargeted backend's cluster is left untouched rather than treated as a conflict. - multi-targetrefs-one-policy: a single BackendTrafficPolicy resource with plural targetRefs naming two backends, rather than one policy per backend - exercises processBackendTrafficPolicyForBackend being called twice for the same policy object, and confirms the resulting ancestor status is a single deduplicated entry, not doubled. - tcp-basic: a merged cluster reached via TCPRoute rather than HTTPRoute - confirms the mechanism is protocol-agnostic (it only walks BackendClusters, never branches on route kind). Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: reject backend-targeted BTP explicitly when mergeBackends is off Backend-targeted BackendTrafficPolicy previously had no code-level check gating it on MergeBackends at all - when the flag was off, the policy simply had nothing to attach to and silently did nothing, with no status signal explaining why. This matches neither the original design doc (which already described this as an explicit gate) nor #8890's own prior-art behavior, and was flagged as an upstream-maintainer requirement during that PR's review (feature should only be reachable once cluster deduplication exists to make it meaningful). Add an explicit per-gateway check in processBackendTrafficPolicyForBackend: a gateway with mergeBackends disabled now gets an Accepted:False/Disabled resolve error (reusing the existing egv1a1.PolicyReasonDisabled reason), rather than silently doing nothing. Other reasons a backend might not resolve to a merged cluster (dynamic resolver, per-listener divergence, simply not referenced by any route) remain silent no-ops, since mergeBackends being on is the one precondition this code can verify directly - the rest depend on route.go's own eligibility decisions. Split the mergebackends-btp-backend-target-unmerged-no-op fixture in two: -mergebackends-disabled (the scenario this fix changes, now showing the explicit Disabled status) and -unreferenced-no-op (a new fixture proving the genuine silent no-op still holds when mergeBackends is on but the backend is simply never referenced by a route). Also corrects two inconsistencies between the design doc and the code: the doc's Non-goals section previously lumped "mergeBackends disabled" into the same silent-no-op bucket as other non-resolution reasons, contradicting its own Resolution-and-merge section; and its Status reporting section said ancestors are "the target backend" when the code correctly uses each matched Gateway (matching BackendTLSPolicy's own precedent). Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: fix stale golden fixture left behind by previous commit mergebackends-btp-backend-target-mergebackends-disabled.out.yaml was committed with its pre-fix content (ancestors: null) instead of the regenerated Disabled-status content the rename was supposed to carry - a staging mistake in the previous commit, not a code issue. Verified via a fresh --override-testdata run that this is the only fixture affected. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * ir: add Traffic field to DestinationSetting for inline backend-targeted BTP Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * ir: force per-setting cluster splitting when a Setting has its own Traffic Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * xds/translator: prefer a single setting's own Traffic over the route's Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: add PolicyReasonUnsupportedBackendTrafficPolicy Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add overrideIfSet helper, the inverse of setIfNil Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: resolve backend-targeted BTP into inline HTTPRoute/GRPCRoute destinations Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: resolve backend-targeted BTP into single-backendRef TCP/UDP destinations Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: carry BackendConnection/DNS through TCP/UDP inline BTP resolution TCPRoute has BackendConnection/DNS fields and UDPRoute has a DNS field that the resolved ClusterTrafficFeatures literals omitted, so a backend-targeted BackendTrafficPolicy setting these fields for a TCP/UDP destination was silently dropped (applyTraffic overwrites rather than merges). Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: don't block multi-backendRef HTTP/GRPC rules from taking a Traffic override Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: fix stale comment after HTTP/GRPC no longer blocks on multi-backendRef The comment above the combined-Warning emission still said "HTTP/GRPC, TCP, and UDP walks" after the previous commit removed HTTP/GRPC's own contribution to blockedRoutes entirely - only TCP/UDP populate it now. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden fixtures for inline HTTP/GRPC backend-targeted BTP Covers the single-backendRef, multi-backendRef-different-policies, partial-coverage, and multi-targetRefs-same-policy scenarios for the inline (non-merged) resolution path added in this branch. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden fixtures for Route-vs-Backend precedence Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: rename multi-rule-warning fixture, it doesn't produce a Warning The Warning/UnsupportedBackendTrafficPolicy condition only ever fires for TCP/UDP/TLS routes (the only route kinds with no per-setting cluster splitting mechanism) - this fixture's name predates the Task 6 fix that correctly stopped HTTP/GRPC's inline walk from blocking on multi-backendRef rules at all, since HasSettingWithTraffic()/NeedsClusterPerSetting() already lets HTTP/GRPC split into per-setting clusters instead. The fixture's actual content is still valid, non-redundant coverage (multi-rule + intra-rule partial coverage + whole-route policy layering, combined) - only the "warning" framing in its name and premise was stale. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden fixtures for TCP/UDP inline backend-targeted BTP Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * ir: fix gofmt alignment in TestRouteDestinationHasSettingWithTraffic Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: fix UDP inline walk dropping backend-policy cluster fields The UDP walk in processBackendTrafficPolicyForBackend only applied LoadBalancer and DNS from a backend-targeted BackendTrafficPolicy, silently dropping CircuitBreaker, HealthCheck, Timeout, TCPKeepalive, BackendConnection, and HTTP2 - asymmetric with the merged-UDP path and the HTTP/TCP inline walks. Add the missing overrideIfSet calls and the Timeout normalization, matching HTTP/TCP. Add a golden fixture proving the UDP circuit-breaker field now applies, and a fixture proving a single BackendTrafficPolicy's ancestor entry for one gateway can carry both Accepted (from a TCPRoute occurrence that succeeds) and Warning (from a sibling occurrence blocked by a shared Envoy cluster) simultaneously. Also fix a stale doc comment on DestinationSetting.Traffic (predated the removal of the HTTP/GRPC walk's len(rd.Settings) > 1 guard), broaden processBackendTrafficPolicyForBackend's doc comment to cover the inline walks, update the release note to cover both phases, and trim several comments that narrated implementation history instead of stating why. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: rename HasTrafficInSettings, extract determineSettingTraffic helper Align RouteDestination.HasSettingWithTraffic's name with the existing HasFiltersInSettings. Extract the repeated len(settings) == 1 && settings[0].Traffic != nil check in asClusterArgs into a named helper next to determineIPFamily, its closest existing analog. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: drop redundant determineSettingTraffic call-site comments Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: drop code-identifier cross-refs, dedupe tests, tidy TCP/UDP asClusterArgs Remove comment references naming NeedsClusterPerSetting directly. Merge TestRouteDestinationNeedsClusterPerSettingWithTraffic into the existing NeedsClusterPerSetting table test and drop the one-off DeepCopy test, which had no equivalent for any other IR type. Move dns/backendConnection into the else-branch of TCP/UDP's asClusterArgs so both branches set every cluster-scoped field explicitly, instead of one being pre-set and silently overwritten. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * release-notes: mention TLSRoute, drop mergeType from the requirement note TLSRoute translates into the same ir.TCPRoute IR type as TCPRoute, so the backend-targeted TCP walk already covers it. mergeType is a CEL-enforced precondition regardless of feature state, not specific to this feature. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: rename blockedRoutes, drop unneeded DeepCopy in HTTP walk blockedRoutes -> unsupportedRoutes, matching PolicyReasonUnsupportedBackendTrafficPolicy instead of colliding conceptually with the unrelated PolicyReasonDisabled case earlier in the same function. route.Traffic.ClusterFeatures() aliases the route's own shared Traffic, so some copy is needed before overriding fields on it. But nothing in this path ever mutates a nested sub-struct in place - every write replaces a top-level pointer wholesale - so a shallow copy is exactly as safe as the recursive DeepCopy and matches the TCP/UDP walks' own field-copy pattern below it. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi,xds/translator: add golden coverage for merged-UDP, RDS-only route precedence, and translator-level split gatewayapi: - udp-basic: merged-cluster case via a UDPRoute, mirroring tcp-basic - no merged UDP fixture existed at all. - multi-backendref-with-gateway: two independently-targeted merged clusters plus a whole-gateway policy layered over both, proving neither backend's fields leak into the other's cluster while the gateway's fields still land on both. - merge-with-rds-only-route: a route-level policy that sets only an RDS field (faultInjection) with mergeType explicit, so it doesn't disqualify its destination from merging. Proves the backend's CDS fields land on the merged BackendCluster while the route's RDS field survives untouched - this specific combination (route policy present, but RDS-only) was untested; route-vs-backend CDS precedence itself is inline-only by construction (hasClusterSettingsBelowGateway forces inline the moment a route/rule sets any cluster-scoped field). xds/translator: no fixture previously drove a DestinationSetting.Traffic override through the actual translator to real Envoy Cluster resources - only unit tests calling asClusterArgs directly, or IR-level gatewayapi fixtures that stop short of xDS output. - http-route-sole-setting-traffic: single setting carrying Traffic wins over the route's own, serialized correctly into the Cluster proto. - http-route-weighted-backend-traffic-split(-three-settings): multiple settings, one carries Traffic - each setting gets its own Cluster resource, not just the targeted one paired against a shared "everyone else" cluster. The three-setting variant is the minimal case that actually distinguishes full per-setting isolation from that alternative. - tcp/udp-route-sole-setting-traffic: same sole-setting proof for TCP/UDP, including UDP's backend-policy-only fields (e.g. circuitBreaker) that ir.UDPRoute itself has no field to carry at the route level. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * release-notes: rename fragment to match PR #9816 Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: don't report Disabled on gateways that don't reference the target backend processBackendTrafficPolicyForBackend iterated every gateway and reported a Disabled ancestor for any of them with mergeBackends off, regardless of whether that gateway's IR referenced the policy's target backend at all. In a cluster with many gateways this could displace real ancestor entries once the 16-ancestor cap kicks in. Add gatewayReferencesBackend and only check it inside the mergeBackends-disabled branch, so the common (enabled) path doesn't pay for a second walk over the same IR the walks below it already traverse. Found by Codex review on #9816. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: permit admissionControl on Service/ServiceImport/Backend targets admissionControl is a cluster-scoped field (already classified as such by btpSpecHasClusterScopedFields, and implemented as an upstream HTTP filter attached to the cluster itself), and the backend-targeted resolution path in processBackendTrafficPolicyForBackend already applies it - but the CEL rule still only allowed Gateway/ListenerSet/HTTPRoute/GRPCRoute targets, so a backend-targeted policy could never actually set it. Extend the rule to match, and regenerate the CRDs and helm-template golden outputs. Found by Codex review on #9816. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: raise patch coverage on processBackendTrafficPolicyForBackend Codecov flagged 71.98% patch coverage on processBackendTrafficPolicyForBackend. Add TestProcessBackendTrafficPolicyForBackendEdgeCases, a single table-driven test calling it directly with hand-built IR to cover: a gateway missing from xdsIR entirely, nil Destination/Route on each of the HTTP/TCP/UDP walks, a multi-setting match with no RouteDestination Metadata (silently skipped, no Warning - matches the existing documented behavior), and the deprecated singular targetRef warning path. Also close a real gap found while investigating: UDP's own multi-backendRef Warning path had no coverage anywhere, unlike TCP's equivalent (tcp-multi-backendref-warning, added back in Task 10) - add the missing udp-multi-backendref-warning golden fixture. Raises the function from 71.98% to 87.9%. The remaining gap is four identically-shaped branches (one per walk) handling mergeBackendTrafficPolicy/ buildTrafficFeatures returning an error - not reachable by any BackendTrafficPolicy that passes CEL validation for a backend target, mirroring the same already-uncovered pattern in this file's pre-existing merged-cluster path. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api,gatewayapi: fix real CI lint failures (gci false-corruption, unparam) CI's lint job failed for two reasons: - gci reported api/v1alpha1/backendtrafficpolicy_types.go:42 as not properly formatted. This is the same '' -> U+201D corruption bug seen earlier working locally, except go1.26.6 in CI hits it too, not just this machine's toolchain - a real blocker, not a local artifact. Rewrite the two empty-string CEL checks (self.targetRef.group == '') as self.targetRef.group.size() == 0, which never produces the adjacent-quote sequence gofmt/gci mishandles. Verified semantically identical by running the full CEL validation suite against real API servers on all 4 tested k8s versions. - unparam flagged newBackendTargetPolicy's name parameter, which every call site passed as the same literal "btp-1". Drop the parameter. Confirmed both fixed by re-running golangci-lint locally with the same config CI uses (0 issues, previously 2 errors). Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: fix inline backend resolution clobbering route's own override The HTTP/TCP/UDP walks merged the backend policy with gwPolicy before overriding onto the route's already-resolved traffic. When the backend policy left a field unset, the merge filled it in from gwPolicy anyway, and that gateway-inherited value then unconditionally overwrote whatever the route had already correctly resolved for that field - discarding a route-level override the backend policy never touched. Use the backend policy's own fields only (buildTrafficFeatures(policy, nil)) as the override source; the gateway's contribution is already reflected in route.Traffic by the time backend processing runs. The merged BackendCluster walk needed no change - it has no competing route-level traffic to preserve. Found by @zhaohuabing on #9816. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: scope backend-BTP ancestor status to referencing gateways, fix false Merged Conflicted, and the walks' own resolve/translation errors, were reported against every gateway passed into processBackendTrafficPolicyForBackend instead of just the ones that actually reference the target backend. Narrow ancestorRefs itself via a pre-pass filtered by gatewayReferencesBackend, and defer the walks' translation-error status to a per-gateway flag so it's still reported with the right ancestor. Also split matchedGWs (identity, feeds Accepted) from a new mergedGWs map (feeds Merged) populated only when walk 1 performs a literal merge with a gateway-level policy - walks 2-4 never merge, so a policy that only ever matched inline was incorrectly tagged Merged. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * xds/translator: fix gen-check drift in Phase 2 RDS golden fixtures initialFetchTimeout: 0s no longer appears in ConfigSource output after the dependency bump picked up in this rebase, same as the unrelated drift main itself fixed in 4de02ef (#9825). These three fixtures were added on this branch after that fix landed on main, so they never picked it up. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * ir,gatewayapi: add RouteDestination.RequiresSingleCluster (unwired) Add RequiresSingleCluster field to ir.RouteDestination to mark destinations that require all backends to resolve to a single Envoy cluster (e.g. rules with fallback backends, session persistence, or consistent-hash load balancing). Deliberately not serialized (json:"-" yaml:"-"): it is a same-process signal produced by route.go and consumed by backendtrafficpolicy.go within a single Translate call. Wire the field through routeDestinationForListener as a new parameter, passing false placeholders at all 4 existing call sites for now - subsequent commits compute and wire the real per-route-kind values. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: thread RequiresSingleCluster through HTTP/GRPC route processing Capture the existing mergeUnsafeForRule (HTTP) / mergeIncompatible (GRPC) value - already computed per rule, before weight-0 filtering - onto httpRouteWithBackendDestinations.requiresSingleCluster, and pass it into routeDestinationForListener's new parameter at the shared HTTP/GRPC call site in processHTTPRouteParentRefListener, replacing the false placeholder. Also fix TestTranslate/TestTranslateWithExtensionKinds: they cmp.Diff generated IR against a YAML-unmarshalled expected struct, and since RequiresSingleCluster is json/yaml:"-", the unmarshalled side is always false while generated IR now correctly carries true on the mergebackends-http-demerge-* fixtures. Ignore the field in both comparisons rather than serialize it. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: thread RequiresSingleCluster through TLS/TCP/UDP route processing Replace the false placeholder at the 3 remaining routeDestinationForListener call sites with the already-computed mergeIncompatible value (mergeIncompatibleForSingleClusterRule's result). TCP and UDP already had this in scope at the call site; TLS's mergeIncompatible was computed inside the per-rule loop, out of scope at the later per-listener call site, so hoist its computation to route scope - allRuleBackendRefs is rule-invariant, so this is a relocation, not a behavior change. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: block backend-targeted BTP on must-stay-single-cluster rules Guard all three inline-Settings walks in processBackendTrafficPolicyForBackend (HTTP, TCP, UDP) on rd.RequiresSingleCluster before writing a backend-targeted policy's Traffic override onto a DestinationSetting: HTTP previously had no guard at all, and TCP/UDP's ad hoc len(rd.Settings) > 1 checks are replaced with the same precise field. Reuses the existing unsupportedRoutes/Warning machinery unchanged - only what triggers it changes. Adds 6 fixture pairs: fallback-backend, session-persistence, and consistent-hash cases (HTTP + one GRPC) proving the block now fires and no Traffic override leaks through; a plain weighted multi-backendRef regression fixture proving ordinary rules still get the override; and a weight-zero- sibling fixture proving the block stays stable across a live traffic-weight change, since RequiresSingleCluster is captured pre-filter. Also updates two backendtrafficpolicy_test.go subtests whose synthetic RouteDestination literals relied on len(Settings) > 1 to reach the block path - same intent, same assertions, updated to set RequiresSingleCluster directly. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi,ir,xds: remove backend-targeted BTP support for demerged destinations Scope backend-targeted BackendTrafficPolicy to merged clusters only. A merged ir.BackendCluster is safe by construction - merge-eligibility already excludes every hazard (fallback backend, session persistence, route-scoped CDS divergence, consistent hash) as a precondition for merging - so this sidesteps the whole class of gap the inline path kept surfacing, most recently a route-scoped ConsistentHash BackendTrafficPolicy demerging via hasClusterSettingsBelowGateway, a mechanism the RequiresSingleCluster guard added earlier today never saw. Removes: DestinationSetting.Traffic and RouteDestination.HasTrafficInSettings (internal/ir/xds.go); the RequiresSingleCluster field and its threading through routeDestinationForListener (internal/gatewayapi/route.go); the HTTP/TCP/UDP inline walks in processBackendTrafficPolicyForBackend (internal/gatewayapi/backendtrafficpolicy.go); the per-setting Traffic branches in *RouteTranslator.asClusterArgs and determineSettingTraffic (internal/xds/translator); the now-unused PolicyReasonUnsupportedBackendTrafficPolicy status reason (api/v1alpha1); and 5 internal/xds/translator/testdata fixture pairs that hand-authored a per-setting Traffic override to test exactly this removed behavior at the translator level. mergeUnsafeForRule/mergeIncompatibleForWeightedRule/ weightedRuleBackendsMustBeInOneCluster/mergeIncompatibleForSingleClusterRule and the Phase 1 merged-cluster mechanism (bc.Traffic, the x.BackendClusters loop) are untouched - this removal is scoped only to backend-targeted-BTP- applies-to-inline-settings, not to mergeBackends merge-eligibility itself. A backend-targeted BackendTrafficPolicy targeting a backend that never merges now silently does not apply - no Warning, matching Phase 1's original behavior before inline support existed. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: remove test fixtures for demerged-destination backend-BTP Delete every mergebackends-btp-backend-target-* fixture that existed specifically to test inline/demerged backend-targeted BackendTrafficPolicy application, precedence, or the now-removed Warning-on-unsupported path. The remaining, merged-cluster-only fixtures regenerate byte-identical - confirming they never depended on the removed code path. Also narrows the 9816 release note to describe only the merged-cluster scope that survived, dropping the inline-application and Route-vs-Backend precedence language that no longer describes shipped behavior. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: update doc comment, drop orphaned overrideIfSet helper Update processBackendTrafficPolicyForBackend's doc comment to accurately reflect the current merged-only behavior following the removal of inline-walk support for backend-targeted BackendTrafficPolicy. Delete the orphaned overrideIfSet[T any] generic helper and its test from helpers.go/helpers_test.go - it was only used by the three deleted inline walks and now has zero production call-sites, unlike this file's other generic helpers (setIfNil, policyOwnerOr, ownerOf, getFirstMatchOrFirstFromData), which all remain in active use. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: reject ConsistentHash load balancing for backend-targeted BackendTrafficPolicy Envoy's hash policy for weighted-cluster selection is route-scoped and singular - it doesn't make sense for different backends in the same weighted route to each request a different hash input via their own backend-targeted policy. Add a CEL rule rejecting loadBalancer.type: ConsistentHash when targeting a Service/ServiceImport/Backend, matching the existing pattern of rejecting rateLimit/faultInjection/etc. for backend targets. Also fixes a pre-existing compile break in test/cel-validation: three unrelated table entries still referenced ClusterSettings.Retry, which moved to BackendSettings.Retry when #8899 split ClusterSettings on main; nobody had run `make go.test.cel` on this branch since that rebase. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: document ConsistentHash rejection and merged-only scope for backend-targeted BTP Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: reject timeout.http.requestTimeout/streamIdleTimeout for backend-targeted BTP Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: stop permitting admissionControl via targetSelectors on backend targets Narrow the admissionControl CEL rule's targetSelectors clause back to Gateway/ListenerSet/HTTPRoute/GRPCRoute, removing Service/ServiceImport/ Backend. Those three kinds were added to this clause alongside targetRef/ targetRefs when admissionControl was extended to backend targets, but targetSelectors is never actually resolved for backend-kind targets at the controller level (ProcessBackendTrafficPolicies calls resolvePolicyTargetsFromReferences, not the selector-aware resolvePolicyTargets, for backend targeting) - so the schema silently accepted a shape that never did anything. Update the one existing test exercising this combination to expect rejection instead of acceptance. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * test(e2e): verify merged Cluster carries backend-targeted BackendTrafficPolicy settings Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * test(e2e): use 512 instead of 777 for the backend-targeted BTP's maxConnections No functional reason for 777 specifically - 512 reads as an intentional, deliberately-configured value rather than an arbitrary one, while still being distinct from Envoy's own max_connections default (1024), which is what route C's existing policy happens to coincide with. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * test(e2e): use 2048 instead of 1024 for route C's maxConnections 1024 is Envoy's own default max_connections, so route C's policy applying could not be distinguished from nothing being configured at all. 2048 is unambiguous, same reasoning as picking 512 (not 777) for the backend-targeted policy. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api,test: address final-review polish items - Clarify the admissionControl rejection message to accurately describe that Service/ServiceImport/Backend targets are supported via targetRef/targetRefs but not targetSelectors, instead of listing them as unconditionally allowed. - Fold the ConsistentHash rejection's rationale into its own CEL message instead of a separate comment, which controller-gen was otherwise pulling into the generated API reference doc with no lead-in. - Harden the new e2e subtest against a convergence race: wait for merge-backends-service-btp to be Accepted before reading live Envoy cluster stats, matching the pattern BackendTrafficPolicyMustBeAccepted already provides and other e2e tests already use. Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * xds/translator: fold leftover post-literal assignments back into struct literals UDP/TCPRouteTranslator.asClusterArgs split loadBalancer/dns (and TCP's other cluster-scoped fields) out of the xdsClusterArgs literal into an else-branch when a since-removed conditional (per-setting Traffic override for inline backend-targeted BTP) needed to pick between two field sets. That conditional is gone, so these were just unconditional statements sitting outside the literal with no behavioral reason to stay there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * api: allow useClientProtocol on backend-targeted BackendTrafficPolicy Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: apply useClientProtocol to merged clusters for backend-targeted BTP Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: add golden tests for backend-targeted BTP useClientProtocol Proves end-to-end that an HTTP merged cluster picks up useClientProtocol from a backend-targeted BackendTrafficPolicy, and a TCP merged cluster does not, even though the policy sets it (same gating as the existing whole-gateway BTP path). No new xds/translator fixture is needed: the translator reads ir.BackendCluster.UseClientProtocol the same way regardless of which policy populated it, and that mechanism is already covered by merge-backends-gateway-traffic.yaml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: style fixups for useClientProtocol gating and its test Blank lines around the protocol-gated block so it doesn't blend into the surrounding lines. Reformat the new table test's cases to one field per line per this repo's table-test convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: scope backend-targeted BTP's merged cluster settings by protocol processBackendTrafficPolicyForBackend copied the full ClusterTrafficFeatures onto every matching merged cluster regardless of its protocol, so HTTP-only fields (healthCheck, http2, admissionControl, ...) could leak onto a udp_proxy/tcp_proxy cluster. Reuse applyGatewayPolicyToMergedCluster, which already subsets correctly per protocol for the whole-gateway BTP path (added in #10016 for the same bug class). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: aggregate backend-targeted BTP status across all of a policy's targets A multi-targetRefs backend-targeted BackendTrafficPolicy had each target write Accepted/Conflicted/Disabled status directly and independently to the same policy.Status, with no coordination between targets sharing an ancestor. SetResolveErrorForPolicyAncestors (used for Conflicted/Disabled/ Invalid) has no guard against overwriting an already-set Accepted condition, unlike SetAcceptedForPolicyAncestor - so whichever target was processed last for a shared ancestor won, and in the worst order a genuinely Accepted result could be silently clobbered by an unrelated target's Conflicted/Disabled/error outcome for the same ancestor. Split processBackendTrafficPolicyForBackend into a pure per-target resolver (now returns a backendTargetOutcome instead of writing status) and a new processBackendTargetedPolicies wrapper that owns the per-policy loop over targets, aggregates accepted/merged/failed outcomes across all of a policy's targets, then commits one status entry per ancestor - walking gateways in their given order for a deterministic result, and never regressing an ancestor another target already got accepted for. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * xds/translator: return UDP/TCP cluster args directly, no local var needed Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: reject targetSelectors naming a backend kind, with a status message Per #9816 (comment): backend targeting only resolves targetRef/targetRefs (resolvePolicyTargetsFromReferences), so a BackendTrafficPolicy using targetSelectors with kind Service/ServiceImport/Backend was previously accepted by the API and then silently had no effect, with no status feedback. Rejects it in Go instead of CEL, avoiding the CEL cost-budget problem a dedicated rejection rule would hit (api/v1alpha1/backendtrafficpolicy_types.go already has two rules traversing the shared TargetSelectors field, and a third pushes the CRD over budget). Resolves the selector against live Service/ServiceImport/Backend objects purely to find which ancestor Gateways to report a resolve error to - the same resolvePolicyTargetsFromSelectors function already used for Gateway/ListenerSet selector targeting elsewhere, not a new mechanism - the match is never applied. Real selector support is tracked as a follow-up: #10212 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: revert backend-target status aggregation, match existing pattern The multi-targetRefs status aggregation added in 892a4fd was not one of zirain's three blocking comments (protocol subsetting, MergeGateways, targetSelectors) - it was a secondary comment this session chose to fix proactively. On reflection, it introduced bespoke behavior found nowhere else in this file: all six other BackendTrafficPolicy target-kind sections (RouteRule, Route, ListenerSet Listener, ListenerSet, Gateway Listener, Gateway) write status directly per-target with no aggregation across a policy's multiple targets, accepting the same "last processed wins" ordering this aggregation tried to fix only for backend targeting. Reverts processBackendTrafficPolicyForBackend to writing status directly (keeping the unrelated protocol-subsetting fix from 557e4d7), removes processBackendTargetedPolicies/backendTargetOutcome/backendTargetFailure, and restores the plain per-target loop in ProcessBackendTrafficPolicies - matching the other six sections' exact shape. rejectBackendTargetSelectors now writes status directly too, for the same reason. Tracked as a cross-cutting follow-up covering all seven sections, not a backend-targeting-specific fix: #10214 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> * gatewayapi: preallocate rejectBackendTargetSelectors' matched slice Fixes a prealloc lint failure in CI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> --------- Signed-off-by: Muhammad Waqar <mwaqar@confluent.io> Co-authored-by: Claude Sonnet 5 <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.
What this PR does / why we need it:
Fixed: apply whole settings of Gateway BTP to merged backends of TCP/UDP incorrectly.
Now, handle which settings are suitable for TCP/UDP merged backends based on merged backend protocol.
Which issue(s) this PR fixes:
Fixes #10015
PR Checklist
git commit -s). See DCO: Sign your work./api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.)release-notes/current/<section>/<pr-number>-<slug>.md(seerelease-notes/current/README.mdfor sections and naming). N/A if this PR does not contain non-trivial changes.make gen-checkand committed the result if API/helm charts/modules changed.release-notes/current/breaking_changes/.