From 28eed561b8f643824b7dd1d36cb03d9e2226306e Mon Sep 17 00:00:00 2001 From: Christian Scott Date: Tue, 28 Jul 2026 11:26:36 -0400 Subject: [PATCH] perf(endpoints): drop the per-endpoint load-balancing-weight wrapper CreateLBEndpoint set LoadBalancingWeight to an explicit uint32 wrapper of value 1 for every endpoint. Envoy treats an unset per-endpoint weight as 1 (in all versions), so the wrapper was a heap allocation per endpoint with no behavioral effect; per-endpoint protos dominate control-plane heap at scale (~60-67% in profiles, with wrappers alone at ~8%). Locality-level LocalityLbEndpoints weights are computed exactly as before, treating an unset endpoint weight as 1 via a new lbWeight() helper. Plugins that set explicit endpoint weights (ServiceEntry, local cluster) are unaffected. Wire compatibility: omitting instead of explicitly sending weight 1 is behavior-identical for any Envoy version. Endpoint equality hashes change once, so envoys receive a single EDS re-push at upgrade (and again on rollback). Benchmarks (included): build path -9.5% B/op, -21% allocs/op at 100/1k/10k endpoints. Golden outputs regenerated: only per-endpoint loadBalancingWeight: 1 lines removed. Signed-off-by: Christian Scott --- pkg/kgateway/endpoints/prioritize.go | 13 +- .../testdata/output/authz-serviceentry.yaml | 2 - .../output/httproute-se-hostname.yaml | 2 - .../testdata/output/httproute-se.yaml | 2 - .../testdata/output/ns-use-waypoint.yaml | 1 - .../experimental/cors-hr-and-tp-out.yaml | 2 - .../cors-httproute-backend-out.yaml | 2 - .../experimental/cors-httproute-rule-out.yaml | 2 - .../cors-trafficpolicy-gw-out.yaml | 1 - .../cors-trafficpolicy-route-out.yaml | 1 - .../failover-default-diffns-out.yaml | 4 - .../failover-default-out.yaml | 4 - .../failover-key-val-labels-out.yaml | 4 - .../failover-label-keys-out.yaml | 4 - .../istio_destination_rule/failover-out.yaml | 4 - .../istio-svc-mtls-disabled-out.yaml | 1 - .../testdata/istio_mtls/istio-svc-out.yaml | 1 - .../listenerbind/v4/happypath-out.yaml | 1 - .../listenerbind/v6/happypath-out.yaml | 1 - .../dr/backendconfigpolicy-alias-out.yaml | 1 - .../serviceentry/dr/se-backendref-out.yaml | 5 - .../serviceentry/dr/se-dns-endpoints-out.yaml | 2 - .../dr/se-hostname-ref-multiport-out.yaml | 6 - .../serviceentry/dr/se-hostname-ref-out.yaml | 3 - .../dr/se-hostname-ref-polattach-out.yaml | 1 - .../serviceentry/dr/se-inline-eps-out.yaml | 3 - ...cesslog-filtercel-httplisteneropt-out.yaml | 1 - ...esslog-filterhttp-httplisteneropt-out.yaml | 2 - .../accesslog-httplisteneropt-out.yaml | 1 - .../auto-host-plus-host-rewrite-out.yaml | 1 - .../backendconfigpolicy-label-out.yaml | 1 - .../standard/backendconfigpolicy-out.yaml | 1 - .../standard/backendconfigpolicy-tls-out.yaml | 1 - .../standard/backendtlspolicy-out.yaml | 1 - .../setup/testdata/standard/csrf-gw-out.yaml | 1 - .../testdata/standard/csrf-route-out.yaml | 1 - .../standard/csrf-route-shadowed-out.yaml | 1 - .../extauth-gw-and-route-disable-out.yaml | 2 - .../standard/extauth-gw-and-route-out.yaml | 3 - .../standard/extauth-gw-only-out.yaml | 2 - .../standard/extauth-route-only-out.yaml | 2 - .../standard/extproc-backend-extref-out.yaml | 3 - .../standard/extproc-routerule-out.yaml | 3 - .../standard/extproc-targetref-out.yaml | 3 - .../testdata/standard/happypath-out.yaml | 1 - .../standard/local-rate-limit-extref-out.yaml | 2 - .../local-rate-limit-route-disabled-out.yaml | 2 - .../local-rate-limit-route-gw-out.yaml | 1 - .../standard/local-rate-limit-route-out.yaml | 1 - .../testdata/standard/routeoptions-out.yaml | 1 - .../transform-gw-and-route-disable-out.yaml | 1 - .../standard/transform-gw-only-out.yaml | 1 - .../standard/transform-route-only-out.yaml | 1 - .../testdata/standard/transformation-out.yaml | 1 - .../traffic_distribution/se-any-out.yaml | 6 - .../se-prefer-same-network-out.yaml | 6 - .../se-prefer-same-node-out.yaml | 6 - .../se-prefer-same-zone-out.yaml | 6 - .../traffic_distribution/svc-any-out.yaml | 4 - .../svc-prefer-close-out.yaml | 4 - .../svc-prefer-same-network-out.yaml | 4 - .../svc-prefer-same-node-out.yaml | 4 - pkg/krtcollections/endpoints.go | 8 +- pkg/krtcollections/endpoints_bench_test.go | 114 ++++++++++++++++++ pkg/krtcollections/endpoints_test.go | 21 ++-- 65 files changed, 144 insertions(+), 154 deletions(-) create mode 100644 pkg/krtcollections/endpoints_bench_test.go diff --git a/pkg/kgateway/endpoints/prioritize.go b/pkg/kgateway/endpoints/prioritize.go index 5bdc41500eb..f629c14b0f2 100644 --- a/pkg/kgateway/endpoints/prioritize.go +++ b/pkg/kgateway/endpoints/prioritize.go @@ -156,6 +156,15 @@ func prioritizeWithLbInfo(logger *slog.Logger, ep ir.EndpointsForBackend, lbInfo return cla } +// lbWeight returns the per-endpoint load balancing weight, treating an unset +// weight as 1, matching Envoy's default (LbEndpoint.load_balancing_weight). +func lbWeight(ep *envoyendpointv3.LbEndpoint) uint32 { + if w := ep.GetLoadBalancingWeight(); w != nil { + return w.GetValue() + } + return 1 +} + // ensure we don't send invalid endpoints to envoy and cause NACKs func filterInvalidEps(eps []ir.EndpointWithMd) []ir.EndpointWithMd { return istioslices.Filter(eps, func(ewm ir.EndpointWithMd) bool { @@ -178,7 +187,7 @@ func getEndpoints(eps []ir.EndpointWithMd, lbinfo LoadBalancingInfo) []*envoyend var weight uint32 for _, ep := range eps { epsOut[0].LbEndpoints = append(epsOut[0].GetLbEndpoints(), ep.LbEndpoint) - weight += ep.LbEndpoint.GetLoadBalancingWeight().GetValue() + weight += lbWeight(ep.LbEndpoint) } // reset weight if weight > 0 { @@ -214,7 +223,7 @@ func applyFailoverPriorityPerLocality( var weight uint32 for _, index := range priorityMap[priority] { out[i].LbEndpoints = append(out[i].GetLbEndpoints(), eps[index].LbEndpoint) - weight += eps[index].GetLoadBalancingWeight().GetValue() + weight += lbWeight(eps[index].LbEndpoint) } // reset weight if weight > 0 { diff --git a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/authz-serviceentry.yaml b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/authz-serviceentry.yaml index 0016c75d4d2..91bc6cf502d 100644 --- a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/authz-serviceentry.yaml +++ b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/authz-serviceentry.yaml @@ -9,7 +9,6 @@ Clusters: socketAddress: address: 1.1.1.1 portValue: 5000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-a_se-a.example.com_5000 type: STATIC @@ -23,7 +22,6 @@ Clusters: socketAddress: address: 2.2.2.2 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-b_se-b.example.com_9000 type: STATIC diff --git a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se-hostname.yaml b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se-hostname.yaml index 771912e1438..410428912d2 100644 --- a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se-hostname.yaml +++ b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se-hostname.yaml @@ -9,7 +9,6 @@ Clusters: socketAddress: address: 1.1.1.1 portValue: 5000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-a_se-a.example.com_5000 type: STATIC @@ -23,7 +22,6 @@ Clusters: socketAddress: address: 2.2.2.2 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-b_se-b.example.com_9000 type: STATIC diff --git a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se.yaml b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se.yaml index 359c78602f3..bbe77ca365e 100644 --- a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se.yaml +++ b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/httproute-se.yaml @@ -9,7 +9,6 @@ Clusters: socketAddress: address: 1.1.1.1 portValue: 5000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-a_se-a.example.com_5000 type: STATIC @@ -23,7 +22,6 @@ Clusters: socketAddress: address: 2.2.2.2 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-b_se-b.example.com_9000 type: STATIC diff --git a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/ns-use-waypoint.yaml b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/ns-use-waypoint.yaml index 71d2314c53d..08c90d88964 100644 --- a/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/ns-use-waypoint.yaml +++ b/pkg/kgateway/extensions2/plugins/waypoint/testdata/output/ns-use-waypoint.yaml @@ -9,7 +9,6 @@ Clusters: socketAddress: address: 3.3.3.3 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_infra_se-c_se-c.infra.svc.cluster.local_9000 type: STATIC diff --git a/pkg/kgateway/setup/testdata/experimental/cors-hr-and-tp-out.yaml b/pkg/kgateway/setup/testdata/experimental/cors-hr-and-tp-out.yaml index e0a18909c2e..4912129198a 100644 --- a/pkg/kgateway/setup/testdata/experimental/cors-hr-and-tp-out.yaml +++ b/pkg/kgateway/setup/testdata/experimental/cors-hr-and-tp-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.12 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -48,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/experimental/cors-httproute-backend-out.yaml b/pkg/kgateway/setup/testdata/experimental/cors-httproute-backend-out.yaml index e498682a75d..1d1cb4de94e 100644 --- a/pkg/kgateway/setup/testdata/experimental/cors-httproute-backend-out.yaml +++ b/pkg/kgateway/setup/testdata/experimental/cors-httproute-backend-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.12 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -48,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/experimental/cors-httproute-rule-out.yaml b/pkg/kgateway/setup/testdata/experimental/cors-httproute-rule-out.yaml index dd8d42dbb5f..08a363719f7 100644 --- a/pkg/kgateway/setup/testdata/experimental/cors-httproute-rule-out.yaml +++ b/pkg/kgateway/setup/testdata/experimental/cors-httproute-rule-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.12 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -48,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-gw-out.yaml b/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-gw-out.yaml index c2ba85102b5..018a152b23e 100644 --- a/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-gw-out.yaml +++ b/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-gw-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-route-out.yaml b/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-route-out.yaml index 4299f530f66..bcb1fbb7120 100644 --- a/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-route-out.yaml +++ b/pkg/kgateway/setup/testdata/experimental/cors-trafficpolicy-route-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-diffns-out.yaml b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-diffns-out.yaml index 04605cb5eae..b5b5c684dd2 100644 --- a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-diffns-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-diffns-out.yaml @@ -39,7 +39,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -51,7 +50,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -64,7 +62,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -77,7 +74,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-out.yaml b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-out.yaml index 19196e66d8d..712d060a690 100644 --- a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-default-out.yaml @@ -39,7 +39,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -51,7 +50,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -64,7 +62,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -77,7 +74,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-key-val-labels-out.yaml b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-key-val-labels-out.yaml index 2950d6bb7c0..2e4a302335d 100644 --- a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-key-val-labels-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-key-val-labels-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -53,7 +51,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -66,7 +63,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-label-keys-out.yaml b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-label-keys-out.yaml index 2950d6bb7c0..2e4a302335d 100644 --- a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-label-keys-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-label-keys-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -53,7 +51,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -66,7 +63,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-out.yaml b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-out.yaml index 9d68293010a..05df16249f8 100644 --- a/pkg/kgateway/setup/testdata/istio_destination_rule/failover-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_destination_rule/failover-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -50,7 +49,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -63,7 +61,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -76,7 +73,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-mtls-disabled-out.yaml b/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-mtls-disabled-out.yaml index 5a29b5375b5..19693f5a06e 100644 --- a/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-mtls-disabled-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-mtls-disabled-out.yaml @@ -143,7 +143,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_httpbin_9000 listeners: diff --git a/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-out.yaml b/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-out.yaml index 11159ea2da4..7d6defb1f92 100644 --- a/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-out.yaml +++ b/pkg/kgateway/setup/testdata/istio_mtls/istio-svc-out.yaml @@ -161,7 +161,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_httpbin_9000 listeners: diff --git a/pkg/kgateway/setup/testdata/listenerbind/v4/happypath-out.yaml b/pkg/kgateway/setup/testdata/listenerbind/v4/happypath-out.yaml index cf1ddc44c48..8fe88aa984d 100644 --- a/pkg/kgateway/setup/testdata/listenerbind/v4/happypath-out.yaml +++ b/pkg/kgateway/setup/testdata/listenerbind/v4/happypath-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/listenerbind/v6/happypath-out.yaml b/pkg/kgateway/setup/testdata/listenerbind/v6/happypath-out.yaml index f16a5bcd532..a6216fc4656 100644 --- a/pkg/kgateway/setup/testdata/listenerbind/v6/happypath-out.yaml +++ b/pkg/kgateway/setup/testdata/listenerbind/v6/happypath-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/backendconfigpolicy-alias-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/backendconfigpolicy-alias-out.yaml index 55ffbfaa31a..12c59909647 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/backendconfigpolicy-alias-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/backendconfigpolicy-alias-out.yaml @@ -9,7 +9,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_gwtest_httpbin-se_se.example.com_80 type: STATIC diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-backendref-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-backendref-out.yaml index c1d621cfbaf..81501037a23 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-backendref-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-backendref-out.yaml @@ -32,7 +32,6 @@ endpoints: socketAddress: address: 255.0.0.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 priority: 3 - lbEndpoints: @@ -41,7 +40,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -53,7 +51,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -66,7 +63,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -79,7 +75,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-dns-endpoints-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-dns-endpoints-out.yaml index 0132ce60d99..46e75d6110b 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-dns-endpoints-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-dns-endpoints-out.yaml @@ -17,7 +17,6 @@ clusters: socketAddress: address: foo.external.com portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -30,7 +29,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-multiport-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-multiport-out.yaml index 5bd3f06b2e2..6a02be44b9b 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-multiport-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-multiport-out.yaml @@ -9,7 +9,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 18443 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -21,7 +20,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 18443 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -33,7 +31,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 18443 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 @@ -51,7 +48,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 18080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -63,7 +59,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 18080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -75,7 +70,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 18080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-out.yaml index d404837efec..01cc7b41590 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-out.yaml @@ -12,7 +12,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -25,7 +24,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -38,7 +36,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-polattach-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-polattach-out.yaml index 8585caf6c5d..6004f3f0946 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-polattach-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-hostname-ref-polattach-out.yaml @@ -9,7 +9,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 name: istio-se_gwtest_example-se_se.example.com_80 transportSocket: diff --git a/pkg/kgateway/setup/testdata/serviceentry/dr/se-inline-eps-out.yaml b/pkg/kgateway/setup/testdata/serviceentry/dr/se-inline-eps-out.yaml index d404837efec..01cc7b41590 100644 --- a/pkg/kgateway/setup/testdata/serviceentry/dr/se-inline-eps-out.yaml +++ b/pkg/kgateway/setup/testdata/serviceentry/dr/se-inline-eps-out.yaml @@ -12,7 +12,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -25,7 +24,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -38,7 +36,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/standard/accesslog-filtercel-httplisteneropt-out.yaml b/pkg/kgateway/setup/testdata/standard/accesslog-filtercel-httplisteneropt-out.yaml index 7236864094e..6f08bb9fa34 100644 --- a/pkg/kgateway/setup/testdata/standard/accesslog-filtercel-httplisteneropt-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/accesslog-filtercel-httplisteneropt-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/accesslog-filterhttp-httplisteneropt-out.yaml b/pkg/kgateway/setup/testdata/standard/accesslog-filterhttp-httplisteneropt-out.yaml index 4882d016061..d1636d545d7 100644 --- a/pkg/kgateway/setup/testdata/standard/accesslog-filterhttp-httplisteneropt-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/accesslog-filterhttp-httplisteneropt-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 50051 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -53,7 +52,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/accesslog-httplisteneropt-out.yaml b/pkg/kgateway/setup/testdata/standard/accesslog-httplisteneropt-out.yaml index c1b0aaa877a..f295afdd929 100644 --- a/pkg/kgateway/setup/testdata/standard/accesslog-httplisteneropt-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/accesslog-httplisteneropt-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/auto-host-plus-host-rewrite-out.yaml b/pkg/kgateway/setup/testdata/standard/auto-host-plus-host-rewrite-out.yaml index 121e645eb07..32315e6c610 100644 --- a/pkg/kgateway/setup/testdata/standard/auto-host-plus-host-rewrite-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/auto-host-plus-host-rewrite-out.yaml @@ -47,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-label-out.yaml b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-label-out.yaml index f130666c1a5..dea6f6288f0 100644 --- a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-label-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-label-out.yaml @@ -46,7 +46,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-out.yaml b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-out.yaml index f130666c1a5..dea6f6288f0 100644 --- a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-out.yaml @@ -46,7 +46,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-tls-out.yaml b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-tls-out.yaml index 71ebfea7205..042ff730b42 100644 --- a/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-tls-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/backendconfigpolicy-tls-out.yaml @@ -119,7 +119,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/backendtlspolicy-out.yaml b/pkg/kgateway/setup/testdata/standard/backendtlspolicy-out.yaml index 2c54e62b458..bc739dceec1 100644 --- a/pkg/kgateway/setup/testdata/standard/backendtlspolicy-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/backendtlspolicy-out.yaml @@ -60,7 +60,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/csrf-gw-out.yaml b/pkg/kgateway/setup/testdata/standard/csrf-gw-out.yaml index 8f61a5a0626..64966602300 100644 --- a/pkg/kgateway/setup/testdata/standard/csrf-gw-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/csrf-gw-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/csrf-route-out.yaml b/pkg/kgateway/setup/testdata/standard/csrf-route-out.yaml index dffb9a2b962..ad98f5340e3 100644 --- a/pkg/kgateway/setup/testdata/standard/csrf-route-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/csrf-route-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/csrf-route-shadowed-out.yaml b/pkg/kgateway/setup/testdata/standard/csrf-route-shadowed-out.yaml index 7c67334bad6..5410e513e82 100644 --- a/pkg/kgateway/setup/testdata/standard/csrf-route-shadowed-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/csrf-route-shadowed-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-disable-out.yaml b/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-disable-out.yaml index 6eed5006b7f..a7e56fadc4b 100644 --- a/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-disable-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-disable-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.2.15 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -53,7 +52,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-out.yaml b/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-out.yaml index f4ec1d41a12..cc946b9e47c 100644 --- a/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extauth-gw-and-route-out.yaml @@ -58,7 +58,6 @@ endpoints: socketAddress: address: 10.244.2.16 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_ext-authz_9000 endpoints: @@ -68,7 +67,6 @@ endpoints: socketAddress: address: 10.244.2.15 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -78,7 +76,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extauth-gw-only-out.yaml b/pkg/kgateway/setup/testdata/standard/extauth-gw-only-out.yaml index 8cba0b58fde..2b3958c374a 100644 --- a/pkg/kgateway/setup/testdata/standard/extauth-gw-only-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extauth-gw-only-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.2.15 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -53,7 +52,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extauth-route-only-out.yaml b/pkg/kgateway/setup/testdata/standard/extauth-route-only-out.yaml index e4cf9fd61d9..99242972ec7 100644 --- a/pkg/kgateway/setup/testdata/standard/extauth-route-only-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extauth-route-only-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.2.15 portValue: 9000 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -53,7 +52,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extproc-backend-extref-out.yaml b/pkg/kgateway/setup/testdata/standard/extproc-backend-extref-out.yaml index dde31ca66d6..9377253f3c0 100644 --- a/pkg/kgateway/setup/testdata/standard/extproc-backend-extref-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extproc-backend-extref-out.yaml @@ -53,7 +53,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 9091 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_ratings_8080 - clusterName: kube_gwtest_reviews_8080 @@ -64,7 +63,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - lbEndpoints: - endpoint: @@ -72,7 +70,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extproc-routerule-out.yaml b/pkg/kgateway/setup/testdata/standard/extproc-routerule-out.yaml index 555022308bf..9659b542b73 100644 --- a/pkg/kgateway/setup/testdata/standard/extproc-routerule-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extproc-routerule-out.yaml @@ -53,7 +53,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 9091 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_ratings_8080 - clusterName: kube_gwtest_reviews_8080 @@ -64,7 +63,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - lbEndpoints: - endpoint: @@ -72,7 +70,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/extproc-targetref-out.yaml b/pkg/kgateway/setup/testdata/standard/extproc-targetref-out.yaml index ee3fdee82b7..a1be08f3f03 100644 --- a/pkg/kgateway/setup/testdata/standard/extproc-targetref-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/extproc-targetref-out.yaml @@ -43,7 +43,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 9091 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -53,7 +52,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - lbEndpoints: - endpoint: @@ -61,7 +59,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/happypath-out.yaml b/pkg/kgateway/setup/testdata/standard/happypath-out.yaml index f16a5bcd532..a6216fc4656 100644 --- a/pkg/kgateway/setup/testdata/standard/happypath-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/happypath-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/local-rate-limit-extref-out.yaml b/pkg/kgateway/setup/testdata/standard/local-rate-limit-extref-out.yaml index 83d1609404c..92354797f22 100644 --- a/pkg/kgateway/setup/testdata/standard/local-rate-limit-extref-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/local-rate-limit-extref-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews-v2_8080 endpoints: @@ -48,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.12 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-disabled-out.yaml b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-disabled-out.yaml index 71f8ac41fc7..67474443e8b 100644 --- a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-disabled-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-disabled-out.yaml @@ -38,7 +38,6 @@ endpoints: socketAddress: address: 10.244.1.12 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 - clusterName: kube_gwtest_reviews_8080 endpoints: @@ -48,7 +47,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-gw-out.yaml b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-gw-out.yaml index 392f0b9a303..44476d8579a 100644 --- a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-gw-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-gw-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-out.yaml b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-out.yaml index da8a7eb09b4..5e37af059e2 100644 --- a/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/local-rate-limit-route-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/routeoptions-out.yaml b/pkg/kgateway/setup/testdata/standard/routeoptions-out.yaml index 81700f7a53d..4f075e0a4ad 100644 --- a/pkg/kgateway/setup/testdata/standard/routeoptions-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/routeoptions-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/standard/transform-gw-and-route-disable-out.yaml b/pkg/kgateway/setup/testdata/standard/transform-gw-and-route-disable-out.yaml index 9eac6770dab..f9842de0268 100644 --- a/pkg/kgateway/setup/testdata/standard/transform-gw-and-route-disable-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/transform-gw-and-route-disable-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/transform-gw-only-out.yaml b/pkg/kgateway/setup/testdata/standard/transform-gw-only-out.yaml index 037524f6fbb..b8f88f3b16b 100644 --- a/pkg/kgateway/setup/testdata/standard/transform-gw-only-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/transform-gw-only-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/transform-route-only-out.yaml b/pkg/kgateway/setup/testdata/standard/transform-route-only-out.yaml index 9a85eb585e1..7d35f87b3c4 100644 --- a/pkg/kgateway/setup/testdata/standard/transform-route-only-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/transform-route-only-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 diff --git a/pkg/kgateway/setup/testdata/standard/transformation-out.yaml b/pkg/kgateway/setup/testdata/standard/transformation-out.yaml index fcedccb1913..027cfdd15b2 100644 --- a/pkg/kgateway/setup/testdata/standard/transformation-out.yaml +++ b/pkg/kgateway/setup/testdata/standard/transformation-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 listeners: - address: diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/se-any-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/se-any-out.yaml index 454fe25b7e5..abc5762730a 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/se-any-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/se-any-out.yaml @@ -9,7 +9,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -21,7 +20,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -33,7 +31,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 @@ -69,7 +66,6 @@ endpoints: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -81,7 +77,6 @@ endpoints: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -93,7 +88,6 @@ endpoints: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-network-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-network-out.yaml index 1c5e80d05e0..fcd18467d8c 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-network-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-network-out.yaml @@ -11,7 +11,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -23,7 +22,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -36,7 +34,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 @@ -73,7 +70,6 @@ endpoints: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -85,7 +81,6 @@ endpoints: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -98,7 +93,6 @@ endpoints: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-node-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-node-out.yaml index fea422c3905..9b81861dc2d 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-node-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-node-out.yaml @@ -11,7 +11,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -24,7 +23,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -37,7 +35,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 @@ -74,7 +71,6 @@ endpoints: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -87,7 +83,6 @@ endpoints: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -100,7 +95,6 @@ endpoints: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-zone-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-zone-out.yaml index a4bcb07e19c..8c1659fe20a 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-zone-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/se-prefer-same-zone-out.yaml @@ -11,7 +11,6 @@ clusters: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -24,7 +23,6 @@ clusters: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -37,7 +35,6 @@ clusters: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 @@ -74,7 +71,6 @@ endpoints: socketAddress: address: 1.1.1.1 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -87,7 +83,6 @@ endpoints: socketAddress: address: 2.2.2.2 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -100,7 +95,6 @@ endpoints: socketAddress: address: 3.3.3.3 portValue: 80 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/svc-any-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/svc-any-out.yaml index d43d25299cc..87c123125cf 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/svc-any-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/svc-any-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -52,7 +50,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -64,7 +61,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-close-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-close-out.yaml index ddeafb918ce..18ade40fb14 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-close-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-close-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -52,7 +50,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -65,7 +62,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-network-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-network-out.yaml index 1960e889d82..c3f6bbd9660 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-network-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-network-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -52,7 +50,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -65,7 +62,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-node-out.yaml b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-node-out.yaml index ccd0ccf804f..e81b1a194fa 100644 --- a/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-node-out.yaml +++ b/pkg/kgateway/setup/testdata/traffic_distribution/svc-prefer-same-node-out.yaml @@ -28,7 +28,6 @@ endpoints: socketAddress: address: 10.244.1.11 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -40,7 +39,6 @@ endpoints: socketAddress: address: 10.244.2.14 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -53,7 +51,6 @@ endpoints: socketAddress: address: 10.244.3.3 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r1 @@ -66,7 +63,6 @@ endpoints: socketAddress: address: 10.244.4.4 portValue: 8080 - loadBalancingWeight: 1 loadBalancingWeight: 1 locality: region: r2 diff --git a/pkg/krtcollections/endpoints.go b/pkg/krtcollections/endpoints.go index e2052ef6c6d..ecf6cf09d8c 100644 --- a/pkg/krtcollections/endpoints.go +++ b/pkg/krtcollections/endpoints.go @@ -6,7 +6,6 @@ import ( envoycorev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoyendpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" "google.golang.org/protobuf/types/known/structpb" - "google.golang.org/protobuf/types/known/wrapperspb" "istio.io/istio/pkg/kube/krt" corev1 "k8s.io/api/core/v1" discoveryv1 "k8s.io/api/discovery/v1" @@ -226,8 +225,11 @@ func CreateLBEndpoint(address string, port uint32, podLabels map[string]string, metadata := istioAutomtlsMetadata(podLabels, enableAutoMtls) return &envoyendpointv3.LbEndpoint{ - Metadata: metadata, - LoadBalancingWeight: wrapperspb.UInt32(1), + Metadata: metadata, + // LoadBalancingWeight is left unset: Envoy treats an unset per-endpoint + // weight as 1, so omitting the wrapper avoids one protobuf wrapper + // allocation per endpoint. Readers must treat nil as weight 1 + // (see kgateway/endpoints.lbWeight). HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ diff --git a/pkg/krtcollections/endpoints_bench_test.go b/pkg/krtcollections/endpoints_bench_test.go new file mode 100644 index 00000000000..e7c0fb0468a --- /dev/null +++ b/pkg/krtcollections/endpoints_bench_test.go @@ -0,0 +1,114 @@ +package krtcollections + +import ( + "fmt" + "runtime" + "testing" + + "github.com/kgateway-dev/kgateway/v2/pkg/pluginsdk/ir" +) + +func testBackend(name string) ir.BackendObjectIR { + return ir.NewBackendObjectIR(ir.ObjectSource{ + Group: "", + Kind: "Service", + Namespace: "default", + Name: name, + }, 80, "", "") +} + +// buildEndpointsForBackend simulates transformK8sEndpoints for a backend with +// `endpoints` ready endpoints spread across `localities` zones. +func buildEndpointsForBackend(name string, endpoints, localities int, autoMtls bool) *ir.EndpointsForBackend { + ret := ir.NewEndpointsForBackend(testBackend(name)) + labels := map[string]string{ + "app": "demo", + "security.istio.io/tlsMode": "istio", + "topology.kubernetes.io/zone": "us-east-1a", + } + for i := 0; i < endpoints; i++ { + loc := ir.PodLocality{ + Region: "us-east-1", + Zone: fmt.Sprintf("us-east-1%c", 'a'+i%localities), + } + ep := CreateLBEndpoint(fmt.Sprintf("10.0.%d.%d", i/256, i%256), 8080, labels, autoMtls) + ret.Add(loc, ir.EndpointWithMd{ + LbEndpoint: ep, + EndpointMd: ir.EndpointMetadata{Labels: labels}, + }) + } + return ret +} + +// BenchmarkBuildEndpointsForBackend measures the per-backend endpoint IR build +// (the CreateLBEndpoint + hashing hot path dominating the heap profiles). +func BenchmarkBuildEndpointsForBackend(b *testing.B) { + for _, endpoints := range []int{100, 1000, 10000} { + b.Run(fmt.Sprintf("endpoints=%d", endpoints), func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + out := buildEndpointsForBackend(fmt.Sprintf("svc-%d", i), endpoints, 3, false) + if len(out.LbEps) == 0 { + b.Fatal("empty") + } + } + }) + } +} + +// BenchmarkCopyEndpointsForBackend compares copying an EndpointsForBackend to a +// variant/final copy by re-hashing every endpoint (old effective_endpoints / +// gateway_backend_variants behavior) vs reusing the precomputed hashes. +func BenchmarkCopyEndpointsForBackend(b *testing.B) { + for _, endpoints := range []int{100, 1000, 10000} { + b.Run(fmt.Sprintf("endpoints=%d", endpoints), func(b *testing.B) { + base := buildEndpointsForBackend("svc", endpoints, 3, false) + b.Run("rehash_add", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + clone := base.EmptyCopy() + for locality, eps := range base.LbEps { + for _, ep := range eps { + clone.Add(locality, ep) + } + } + if clone.LbEpsEqualityHash != base.LbEpsEqualityHash { + b.Fatal("hash mismatch") + } + } + }) + b.Run("reuse_hashes", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + clone := base.EmptyCopy() + clone.ReuseEndpointsFrom(base) + if clone.LbEpsEqualityHash != base.LbEpsEqualityHash { + b.Fatal("hash mismatch") + } + } + }) + }) + } +} + +// TestBenchHeapDelta reports heap allocated by building N backends' endpoints, +// for manual before/after comparison with runtime.ReadMemStats. +func TestBenchHeapDelta(t *testing.T) { + const backends = 200 + const endpoints = 1000 + runtime.GC() + var before runtime.MemStats + runtime.ReadMemStats(&before) + refs := make([]*ir.EndpointsForBackend, 0, backends) + for i := 0; i < backends; i++ { + refs = append(refs, buildEndpointsForBackend(fmt.Sprintf("svc-%d", i), endpoints, 3, false)) + } + runtime.GC() + var after runtime.MemStats + runtime.ReadMemStats(&after) + t.Logf("backends=%d endpoints/backend=%d total_eps=%d heap_alloc_delta=%d bytes (%.1f bytes/endpoint)", + backends, endpoints, backends*endpoints, + after.HeapAlloc-before.HeapAlloc, + float64(after.HeapAlloc-before.HeapAlloc)/float64(backends*endpoints)) + runtime.KeepAlive(refs) +} diff --git a/pkg/krtcollections/endpoints_test.go b/pkg/krtcollections/endpoints_test.go index 2236e2bdd57..457b9d191cc 100644 --- a/pkg/krtcollections/endpoints_test.go +++ b/pkg/krtcollections/endpoints_test.go @@ -6,7 +6,6 @@ import ( envoycorev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoyendpointv3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" - "google.golang.org/protobuf/types/known/wrapperspb" "istio.io/istio/pkg/kube/krt" "istio.io/istio/pkg/kube/krt/krttest" corev1 "k8s.io/api/core/v1" @@ -619,7 +618,6 @@ func TestEndpoints(t *testing.T) { // output emd := ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -872,7 +870,6 @@ func TestEndpoints(t *testing.T) { Zone: "zone", }, ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -901,7 +898,6 @@ func TestEndpoints(t *testing.T) { Zone: "zone2", }, ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -1018,7 +1014,6 @@ func TestEndpoints(t *testing.T) { // output emd := ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -1168,7 +1163,6 @@ func TestEndpoints(t *testing.T) { // Only one endpoint should be present after deduplication emd := ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -1398,7 +1392,6 @@ func TestEndpoints(t *testing.T) { // output emd := ir.EndpointWithMd{ LbEndpoint: &envoyendpointv3.LbEndpoint{ - LoadBalancingWeight: wrapperspb.UInt32(1), HostIdentifier: &envoyendpointv3.LbEndpoint_Endpoint{ Endpoint: &envoyendpointv3.Endpoint{ Address: &envoycorev3.Address{ @@ -1474,6 +1467,20 @@ func TestEndpoints(t *testing.T) { } } +func TestCreateLBEndpointNoWeightWrapper(t *testing.T) { + ep := CreateLBEndpoint("10.0.0.1", 8080, nil, false) + if ep.GetLoadBalancingWeight() != nil { + t.Fatal("expected no LoadBalancingWeight wrapper; unset weight defaults to 1 in Envoy") + } + if ep.GetMetadata() != nil { + t.Fatal("expected nil Metadata when automtls disabled") + } + sock := ep.GetEndpoint().GetAddress().GetSocketAddress() + if sock.GetAddress() != "10.0.0.1" || sock.GetPortValue() != 8080 { + t.Fatalf("unexpected socket address: %v:%d", sock.GetAddress(), sock.GetPortValue()) + } +} + func TestCreateLBEndpointAutoMtls(t *testing.T) { labels := map[string]string{wellknown.IstioTlsModeLabel: "istio"}