From cd964bbe0dc5dfcb9ac62f650afc4070dffb90c8 Mon Sep 17 00:00:00 2001 From: kei-gnu <61653118+kei-gnu@users.noreply.github.com> Date: Tue, 21 Apr 2026 19:27:32 +0900 Subject: [PATCH] istio: add splitExternalLocalOriginErrors and consecutiveLocalOriginFailures support Signed-off-by: kei-gnu <61653118+kei-gnu@users.noreply.github.com> --- artifacts/flagger/crd.yaml | 10 ++++++++++ charts/flagger/crds/crd.yaml | 10 ++++++++++ kustomize/base/flagger/crd.yaml | 10 ++++++++++ pkg/apis/istio/v1beta1/destination_rule.go | 15 +++++++++++++++ pkg/apis/istio/v1beta1/zz_generated.deepcopy.go | 5 +++++ 5 files changed, 50 insertions(+) diff --git a/artifacts/flagger/crd.yaml b/artifacts/flagger/crd.yaml index 4b8f039f..fdadb971 100644 --- a/artifacts/flagger/crd.yaml +++ b/artifacts/flagger/crd.yaml @@ -859,6 +859,12 @@ spec: ejected from the connection pool. format: int32 type: integer + consecutiveLocalOriginFailures: + description: Number of consecutive locally originated + failures before ejection. Takes effect only when + splitExternalLocalOriginErrors is set to true. + format: int32 + type: integer interval: description: Time interval between ejection sweep analysis. type: string @@ -868,6 +874,10 @@ spec: minHealthPercent: format: int32 type: integer + splitExternalLocalOriginErrors: + description: Determines whether to distinguish local + origin failures from external errors. + type: boolean tls: description: Istio TLS related settings for connections to the upstream service type: object diff --git a/charts/flagger/crds/crd.yaml b/charts/flagger/crds/crd.yaml index 4b8f039f..fdadb971 100644 --- a/charts/flagger/crds/crd.yaml +++ b/charts/flagger/crds/crd.yaml @@ -859,6 +859,12 @@ spec: ejected from the connection pool. format: int32 type: integer + consecutiveLocalOriginFailures: + description: Number of consecutive locally originated + failures before ejection. Takes effect only when + splitExternalLocalOriginErrors is set to true. + format: int32 + type: integer interval: description: Time interval between ejection sweep analysis. type: string @@ -868,6 +874,10 @@ spec: minHealthPercent: format: int32 type: integer + splitExternalLocalOriginErrors: + description: Determines whether to distinguish local + origin failures from external errors. + type: boolean tls: description: Istio TLS related settings for connections to the upstream service type: object diff --git a/kustomize/base/flagger/crd.yaml b/kustomize/base/flagger/crd.yaml index 4b8f039f..fdadb971 100644 --- a/kustomize/base/flagger/crd.yaml +++ b/kustomize/base/flagger/crd.yaml @@ -859,6 +859,12 @@ spec: ejected from the connection pool. format: int32 type: integer + consecutiveLocalOriginFailures: + description: Number of consecutive locally originated + failures before ejection. Takes effect only when + splitExternalLocalOriginErrors is set to true. + format: int32 + type: integer interval: description: Time interval between ejection sweep analysis. type: string @@ -868,6 +874,10 @@ spec: minHealthPercent: format: int32 type: integer + splitExternalLocalOriginErrors: + description: Determines whether to distinguish local + origin failures from external errors. + type: boolean tls: description: Istio TLS related settings for connections to the upstream service type: object diff --git a/pkg/apis/istio/v1beta1/destination_rule.go b/pkg/apis/istio/v1beta1/destination_rule.go index d0ef676c..b560fa88 100644 --- a/pkg/apis/istio/v1beta1/destination_rule.go +++ b/pkg/apis/istio/v1beta1/destination_rule.go @@ -620,6 +620,21 @@ type OutlierDetection struct { // no effect. Consecutive5xxErrors *uint32 `json:"consecutive5xxErrors,omitempty"` + // Determines whether to distinguish local origin failures from external errors. If set to true + // `consecutiveLocalOriginFailures` is taken into account for outlier detection calculations. + // This should be used when you want to derive the outlier detection status based on the errors + // seen locally such as failure to connect, timeout while connecting etc. rather than the status code + // returned by upstream service. This is especially useful when the upstream service explicitly returns + // a 5xx for some requests and you want to ignore those responses from upstream service while determining + // the outlier detection status of a host. + // Defaults to false. + SplitExternalLocalOriginErrors bool `json:"splitExternalLocalOriginErrors,omitempty"` + + // The number of consecutive locally originated failures before ejection + // occurs. Defaults to 5. Parameter takes effect only when `splitExternalLocalOriginErrors` + // is set to true. + ConsecutiveLocalOriginFailures *uint32 `json:"consecutiveLocalOriginFailures,omitempty"` + // Time interval between ejection sweep analysis. format: // 1h/1m/1s/1ms. MUST BE >=1ms. Default is 10s. Interval string `json:"interval,omitempty"` diff --git a/pkg/apis/istio/v1beta1/zz_generated.deepcopy.go b/pkg/apis/istio/v1beta1/zz_generated.deepcopy.go index 2667de29..1c833c4d 100644 --- a/pkg/apis/istio/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/istio/v1beta1/zz_generated.deepcopy.go @@ -728,6 +728,11 @@ func (in *OutlierDetection) DeepCopyInto(out *OutlierDetection) { *out = new(uint32) **out = **in } + if in.ConsecutiveLocalOriginFailures != nil { + in, out := &in.ConsecutiveLocalOriginFailures, &out.ConsecutiveLocalOriginFailures + *out = new(uint32) + **out = **in + } return }