Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make panic threshold configurable for cluster #5118

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
14 changes: 9 additions & 5 deletions api/v1alpha1/healthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// HealthCheck configuration to decide which endpoints
// are healthy and can be used for routing.
//
// Note: Once the overall health of the backendRef drops below 50% (e.g. a backendRef having 10 endpoints
// with more than 5 unhealthy endpoints), Envoy will disregard health status and balance across all endpoints.
// This is called "panic mode". It's designed to prevent a situation in which host failures cascade throughout the cluster
// as load increases.
type HealthCheck struct {
// Active health check configuration
// +optional
Expand All @@ -22,6 +17,15 @@ type HealthCheck struct {
// Passive passive check configuration
// +optional
Passive *PassiveHealthCheck `json:"passive,omitempty"`

// When number of unhealthy endpoints for a backend reaches this threshold
// Envoy will disregard health status and balance across all endpoints.
// It's designed to prevent a situation in which host failures cascade throughout the cluster
// as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=100
// +optional
PanicThreshold *uint32 `json:"panicThreshold,omitempty"`
}

// PassiveHealthCheck defines the configuration for passive health checks in the context of Envoy's Outlier Detection,
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,16 @@ spec:
- message: The grpc field can only be set if the Health Checker
type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC'' : true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,16 @@ spec:
- message: The grpc field can only be set if the Health
Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC'' : true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10992,6 +10992,16 @@ spec:
is GRPC.
rule: 'has(self.grpc) ? self.type
== ''GRPC'' : true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check
configuration
Expand Down Expand Up @@ -11969,6 +11979,16 @@ spec:
is GRPC.
rule: 'has(self.grpc) ? self.type
== ''GRPC'' : true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check
configuration
Expand Down Expand Up @@ -13025,6 +13045,16 @@ spec:
if the Health Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC''
: true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down Expand Up @@ -14008,6 +14038,16 @@ spec:
Health Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC''
: true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,16 @@ spec:
Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC'' :
true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down Expand Up @@ -1821,6 +1831,16 @@ spec:
Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC'' :
true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down Expand Up @@ -2843,6 +2863,16 @@ spec:
the Health Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC''
: true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down Expand Up @@ -3852,6 +3882,16 @@ spec:
Checker type is GRPC.
rule: 'has(self.grpc) ? self.type == ''GRPC'' :
true'
panicThreshold:
description: |-
When number of unhealthy endpoints for a backend reaches this threshold
Envoy will disregard health status and balance across all endpoints.
It's designed to prevent a situation in which host failures cascade throughout the cluster
as load increases. If not set, the default value is 50%. To disable panic mode, set value to `0`.
format: int32
maximum: 100
minimum: 0
type: integer
passive:
description: Passive passive check configuration
properties:
Expand Down
2 changes: 1 addition & 1 deletion internal/gatewayapi/clustersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func buildHealthCheck(policy egv1a1.ClusterSettings) *ir.HealthCheck {
irhc := &ir.HealthCheck{}
irhc.Passive = buildPassiveHealthCheck(*policy.HealthCheck)
irhc.Active = buildActiveHealthCheck(*policy.HealthCheck)

irhc.PanicThreshold = policy.HealthCheck.PanicThreshold
return irhc
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
gateways:
- apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
namespace: envoy-gateway
name: gateway-1
spec:
gatewayClassName: envoy-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
- apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
namespace: envoy-gateway
name: gateway-2
spec:
gatewayClassName: envoy-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
httpRoutes:
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-1
spec:
hostnames:
- gateway.envoyproxy.io
parentRefs:
- namespace: envoy-gateway
name: gateway-2
sectionName: http
rules:
- matches:
- path:
value: "/"
backendRefs:
- name: service-1
port: 8080
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-2
spec:
hostnames:
- gateway.envoyproxy.io
parentRefs:
- namespace: envoy-gateway
name: gateway-2
sectionName: http
rules:
- matches:
- path:
value: "/v2"
backendRefs:
- name: service-2
port: 8080
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-3
spec:
hostnames:
- gateway.envoyproxy.io
parentRefs:
- namespace: envoy-gateway
name: gateway-1
sectionName: http
rules:
- matches:
- path:
value: "/v3"
backendRefs:
- name: service-3
port: 8080
backendTrafficPolicies:
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
namespace: default
name: policy-for-route-1
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: httproute-1
healthCheck:
panicThreshold: 66
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
namespace: default
name: policy-for-route-2
spec:
targetRef:
group: gateway.networking.k8s.io
kind: HTTPRoute
name: httproute-2
healthCheck:
panicThreshold: 10
- apiVersion: gateway.envoyproxy.io/v1alpha1
kind: BackendTrafficPolicy
metadata:
namespace: envoy-gateway
name: policy-for-all-routes-in-gateway-1
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: gateway-1
healthCheck:
panicThreshold: 80
Loading
Loading