Skip to content

Commit

Permalink
update outlier-detection-design.md
Browse files Browse the repository at this point in the history
Signed-off-by: yy <[email protected]>
  • Loading branch information
yangyy93 committed Jul 4, 2023
1 parent b3cb403 commit 5792281
Showing 1 changed file with 9 additions and 55 deletions.
64 changes: 9 additions & 55 deletions design/outlier-detection-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ Add a new field in the CRD of httpproxy for configuring Outlier Detection of the
```go
// OutlierDetection defines the configuration for outlier detection on a service.
type OutlierDetection struct {
// Consecutive5xxErrors defines The number of consecutive server-side error responses before a consecutive 5xx ejection occurs.
// ConsecutiveServerErrors defines The number of consecutive server-side error responses before a consecutive 5xx ejection occurs.
// When the backend host encounters consecutive
// errors greater than or equal to Consecutive5xxErrors, it will be
// errors greater than or equal to ConsecutiveServerErrors, it will be
// ejected from the load balancing pool.
// for HTTP services, a 5xx counts as an error and for TCP services
// connection failures and connection timeouts count as an error.
// It can be disabled by setting the value to 0.
// Defaults to 5.
// +optional
Consecutive5xxErrors *uint32 `json:"consecutive5xxErrors,omitempty"`
ConsecutiveServerErrors *uint32 `json:"consecutiveServerErrors,omitempty"`

// Interval is the interval at which host status is evaluated.
// Defaults to 10s.
Expand Down Expand Up @@ -68,21 +68,12 @@ type OutlierDetection struct {
// Defaults to 5.
ConsecutiveLocalOriginFailure *uint32 `json:"consecutiveLocalOriginFailure,omitempty"`

// MaxEjectionPercent is the max percentage of hosts in the load balancing pool for the upstream service.
// MaxEjectionPercent is the max percentage of hosts in the load balancing pool for the upstream service that can be ejected.
// But will eject at least one host regardless of the value here.
// Defaults to 10%.
// +optional
// +kubebuilder:validation:Maximum=100
MaxEjectionPercent *uint32 `json:"maxEjectionPercent,omitempty"`

// MinHealthPercent is the minimum percentage of hosts in the load balancing pool for the upstream service.
// If the number of hosts in the load balancing pool is less than the value set here, the outlier detection will not be performed.
// https://www.envoyproxy.io/docs/envoy/v1.26.2/intro/arch_overview/upstream/load_balancing/panic_threshold#arch-overview-load-balancing-panic-threshold
// Defaults to 0%.
// +optional
// +kubebuilder:validation:Maximum=100
// +kubebuilder:default=0
MinHealthPercent *uint32 `json:"minHealthPercent,omitempty"`
}
```

Expand All @@ -107,7 +98,7 @@ spec:
- name: s1
port: 80
outlierDetection:
consecutive5xxErrors: 5
consecutiveServerErrors: 5
maxEjectionPercent: 100
```
In this example, when s1 service experiences 5 consecutive 5xx errors (including locally originated and externally originated (transaction) errors), s1 service will be ejected, with a maximum ejection rate of 100%. Panic is disabled, which is also the default value.
Expand All @@ -130,43 +121,6 @@ cluster:
```yaml
apiVersion: projectcontour.io/v1alpha1
kind: HTTPProxy
metadata:
name: simple-5xx-health-panic
namespace: projectcontour
spec:
virtualhost:
fqdn: outlierDetection.projectcontour.io
routes:
- conditions:
- prefix: /
services:
- name: s1
port: 80
outlierDetection:
consecutive5xxErrors: 5
maxEjectionPercent: 100
minHealthPercent: 50
```
In this example, when the s1 service encounters 5 consecutive 5xx errors (including locally and externally originated transaction errors), the s1 service will be ejected with a maximum ejection ratio of 100%. However, if the number of healthy instances of the s1 service drops below 50%, outlier detection will not continue to be executed.
The generated envoy configuration is:
```yaml
cluster:
common_lb_config:
healthy_panic_threshold:
value: 50.0
outlier_detection:
enforcing_success_rate: 0
consecutive_5xx: 5
enforcing_consecutive_5xx: 100
max_ejection_percent: 100
enforcing_consecutive_gateway_failure: 0
```
### Example 3
```yaml
apiVersion: projectcontour.io/v1alpha1
kind: HTTPProxy
metadata:
name: only-local-external-origin-errors
namespace: projectcontour
Expand All @@ -180,7 +134,7 @@ spec:
- name: s1
port: 80
outlierDetection:
consecutive5xxErrors: 0
consecutiveServerErrors: 0
maxEjectionPercent: 100
splitExternalLocalOriginErrors: true
consecutiveLocalOriginFailure: 5
Expand All @@ -205,7 +159,7 @@ cluster:
enforcing_consecutive_gateway_failure: 0
```
### Example 4
### Example 3
```yaml
apiVersion: projectcontour.io/v1alpha1
kind: HTTPProxy
Expand All @@ -222,7 +176,7 @@ spec:
- name: s1
port: 80
outlierDetection:
consecutive5xxErrors: 10
consecutiveServerErrors: 10
maxEjectionPercent: 100
splitExternalLocalOriginErrors: true
consecutiveLocalOriginFailure: 5
Expand All @@ -249,7 +203,7 @@ cluster:
```
Notes:
- If consecutive5xxErrors is specified as 0, and splitExternalLocalOriginErrors is true, then local errors will be ignored.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.
- If consecutiveServerErrors is specified as 0, and splitExternalLocalOriginErrors is true, then local errors will be ignored.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.
- When accessing the upstream host through an opaque TCP connection, connection timeouts, connection errors, and request failures are all considered 5xx errors, and therefore these events are included in the 5xx error statistics.
- Please refer to the [official documentation of Envoy][1] for more instructions.
Expand Down

0 comments on commit 5792281

Please sign in to comment.