Skip to content

Commit

Permalink
add service outlier detection
Browse files Browse the repository at this point in the history
Signed-off-by: yy <[email protected]>

add changelog

Signed-off-by: yy <[email protected]>
  • Loading branch information
yangyy93 committed Oct 18, 2023
1 parent d53f2a3 commit c0d066a
Show file tree
Hide file tree
Showing 18 changed files with 1,214 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apis/projectcontour/v1/detailedconditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ const (
// with an HTTPProxy resource which is not part of a delegation chain.
ConditionTypeOrphanedError = "Orphaned"

// ConditionTypeOutlierDetectionError describes an error condition with
// an HTTPProxy Outlier Detection issue.
ConditionTypeOutlierDetectionError = "OutlierDetectionError"

// ConditionTypePrefixReplaceError describes an error condition with
// an HTTPProxy path prefix replacement issue.
ConditionTypePrefixReplaceError = "PrefixReplaceError"
Expand Down
56 changes: 56 additions & 0 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,62 @@ type Service struct {
// Slow start will gradually increase amount of traffic to a newly added endpoint.
// +optional
SlowStartPolicy *SlowStartPolicy `json:"slowStartPolicy,omitempty"`
// The policy for managing outlier detection on a service.
OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty"`
}

// OutlierDetection defines the configuration for outlier detection on a service.
type OutlierDetection struct {
// 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 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
ConsecutiveServerErrors *uint32 `json:"consecutiveServerErrors,omitempty"`

// Interval is the interval at which host status is evaluated.
// Defaults to 10s.
// +optional
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$`
Interval *string `json:"interval,omitempty"`

// BaseEjectionTime is the base time that a host is ejected for.
// A host will remain ejected for a period of time equal to the
// product of the ejection base duration and the number of times the host has been ejected.
// Defaults to 30s.
// +optional
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$`
BaseEjectionTime *string `json:"baseEjectionTime,omitempty"`

// MaxEjectionTime is the maximum time a host will be ejected for.
// After this amount of time, a host will be returned to normal operation.
// If not specified, the default value (300s) or BaseEjectionTime value is applied, whatever is larger.
// Defaults to 300s.
// +optional
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$`
MaxEjectionTime *string `json:"maxEjectionTime,omitempty"`

// SplitExternalLocalOriginErrors defines whether to split the local origin errors from the external origin errors.
// Defaults to false.
// +optional
// +kubebuilder:default=false
SplitExternalLocalOriginErrors bool `json:"splitExternalLocalOriginErrors"`

// ConsecutiveLocalOriginFailure defines the number of consecutive local origin failures before a consecutive local origin ejection occurs.
// Parameters take effect only when SplitExternalLocalOriginErrors is true.
// Defaults to 5.
ConsecutiveLocalOriginFailure *uint32 `json:"consecutiveLocalOriginFailure,omitempty"`

// 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"`
}

// HTTPHealthCheckPolicy defines health checks on the upstream service.
Expand Down
50 changes: 50 additions & 0 deletions apis/projectcontour/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions changelogs/unreleased/5575-yangyy93-minor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Add outlier detection related configuration detection for services

Add [outlier detection](https://www.envoyproxy.io/docs/envoy/v1.26.3/intro/arch_overview/upstream/outlier#arch-overview-outlier-detection) related configuration detection for services, including consecutiveServerErrors and localOriginal errors, and passive health checks can be performed on clusters.
126 changes: 126 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6266,6 +6266,69 @@ spec:
up corresponding endpoints which contain the ips to
route.
type: string
outlierDetection:
description: The policy for managing outlier detection
on a service.
properties:
baseEjectionTime:
description: BaseEjectionTime is the base time that
a host is ejected for. A host will remain ejected
for a period of time equal to the product of the
ejection base duration and the number of times the
host has been ejected. Defaults to 30s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
consecutiveLocalOriginFailure:
description: ConsecutiveLocalOriginFailure defines
the number of consecutive local origin failures
before a consecutive local origin ejection occurs.
Parameters take effect only when SplitExternalLocalOriginErrors
is true. Defaults to 5.
format: int32
type: integer
consecutiveServerErrors:
description: 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 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.
format: int32
type: integer
interval:
description: Interval is the interval at which host
status is evaluated. Defaults to 10s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
maxEjectionPercent:
description: 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%.
format: int32
maximum: 100
type: integer
maxEjectionTime:
description: MaxEjectionTime is the maximum time a
host will be ejected for. After this amount of time,
a host will be returned to normal operation. If
not specified, the default value (300s) or BaseEjectionTime
value is applied, whatever is larger. Defaults to
300s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
splitExternalLocalOriginErrors:
default: false
description: SplitExternalLocalOriginErrors defines
whether to split the local origin errors from the
external origin errors. Defaults to false.
type: boolean
type: object
port:
description: Port (defined as Integer) to proxy traffic
to since a service can have multiple defined.
Expand Down Expand Up @@ -6663,6 +6726,69 @@ spec:
traffic. Names defined here will be used to look up corresponding
endpoints which contain the ips to route.
type: string
outlierDetection:
description: The policy for managing outlier detection on
a service.
properties:
baseEjectionTime:
description: BaseEjectionTime is the base time that
a host is ejected for. A host will remain ejected
for a period of time equal to the product of the ejection
base duration and the number of times the host has
been ejected. Defaults to 30s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
consecutiveLocalOriginFailure:
description: ConsecutiveLocalOriginFailure defines the
number of consecutive local origin failures before
a consecutive local origin ejection occurs. Parameters
take effect only when SplitExternalLocalOriginErrors
is true. Defaults to 5.
format: int32
type: integer
consecutiveServerErrors:
description: 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 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.
format: int32
type: integer
interval:
description: Interval is the interval at which host
status is evaluated. Defaults to 10s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
maxEjectionPercent:
description: 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%.
format: int32
maximum: 100
type: integer
maxEjectionTime:
description: MaxEjectionTime is the maximum time a host
will be ejected for. After this amount of time, a
host will be returned to normal operation. If not
specified, the default value (300s) or BaseEjectionTime
value is applied, whatever is larger. Defaults to
300s.
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms))+)$
type: string
splitExternalLocalOriginErrors:
default: false
description: SplitExternalLocalOriginErrors defines
whether to split the local origin errors from the
external origin errors. Defaults to false.
type: boolean
type: object
port:
description: Port (defined as Integer) to proxy traffic
to since a service can have multiple defined.
Expand Down
Loading

0 comments on commit c0d066a

Please sign in to comment.