From 7d29af4f41ab319d883fe086c84d48bcb2e5fce7 Mon Sep 17 00:00:00 2001 From: Ivan Lopes Date: Thu, 25 May 2023 10:00:54 -0300 Subject: [PATCH] Add support for istio LEAST_REQUEST destination rule load balancing algorithm Signed-off-by: Ivan Lopes --- artifacts/flagger/crd.yaml | 1 + charts/flagger/crds/crd.yaml | 1 + kustomize/base/flagger/crd.yaml | 1 + pkg/apis/istio/v1alpha3/destination_rule.go | 6 ++++++ 4 files changed, 9 insertions(+) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 4b00c02f..9fdda586 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -756,6 +756,7 @@ spec: - LEAST_CONN - RANDOM - PASSTHROUGH + - LEAST_REQUEST type: string outlierDetection: description: Settings controlling eviction of unhealthy hosts from the load balancing pool. diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 4b00c02f..9fdda586 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -756,6 +756,7 @@ spec: - LEAST_CONN - RANDOM - PASSTHROUGH + - LEAST_REQUEST type: string outlierDetection: description: Settings controlling eviction of unhealthy hosts from the load balancing pool. diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 4b00c02f..9fdda586 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -756,6 +756,7 @@ spec: - LEAST_CONN - RANDOM - PASSTHROUGH + - LEAST_REQUEST type: string outlierDetection: description: Settings controlling eviction of unhealthy hosts from the load balancing pool. diff --git a/pkg/apis/istio/v1alpha3/destination_rule.go b/pkg/apis/istio/v1alpha3/destination_rule.go index 52785cc0..e9e9a761 100644 --- a/pkg/apis/istio/v1alpha3/destination_rule.go +++ b/pkg/apis/istio/v1alpha3/destination_rule.go @@ -419,6 +419,12 @@ const ( // advanced use cases. Refer to Original Destination load balancer in // Envoy for further details. SimpleLBPassthrough SimpleLB = "PASSTHROUGH" + + // The least request load balancer spreads load across endpoints, + // favoring endpoints with the least outstanding requests. This is generally + // safer and outperforms ROUND_ROBIN in nearly all cases. Prefer to use LEAST_REQUEST + // as a drop-in replacement for ROUND_ROBIN. + SimpleLBLeastRequest SimpleLB = "LEAST_REQUEST" ) // Consistent Hash-based load balancing can be used to provide soft