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

Backport of Adds fields for PassiveHealthCheck on IngressGateway into release/1.0.x #2858

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2796.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ingress-gateway: Adds missing PassiveHealthCheck to IngressGateways CRD and updates missing fields on ServiceDefaults CRD
```
78 changes: 78 additions & 0 deletions charts/consul/templates/crd-ingressgateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,43 @@ spec:
while waiting for a connection to be established.
format: int32
type: integer
passiveHealthCheck:
description: PassiveHealthCheck configuration determines how upstream
proxy instances will be monitored for removal from the load
balancing pool.
properties:
baseEjectionTime:
description: The base time that a host is ejected for. The
real time is equal to the base time multiplied by the number
of times the host has been ejected and is capped by max_ejection_time
(Default 300s). Defaults to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance that
a host will be actually ejected when an outlier status is
detected through consecutive 5xx. This setting can be used
to disable ejection or to ramp it up slowly. Ex. Setting
this to 10 will make it a 10% chance that the host will
be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis sweeps.
Each sweep may remove hosts or return hosts to the pool.
Ex. setting this to "10s" will set the interval to 10 seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster that can
be ejected due to outlier detection. Defaults to 10% but
will eject at least one host regardless of the value.
format: int32
type: integer
maxFailures:
description: MaxFailures is the count of consecutive failures
that results in a host being removed from the pool.
format: int32
type: integer
type: object
type: object
listeners:
description: Listeners declares what ports the ingress gateway should
Expand Down Expand Up @@ -157,6 +194,47 @@ spec:
service is located. Partitioning is a Consul Enterprise
feature.
type: string
passiveHealthCheck:
description: PassiveHealthCheck configuration determines
how upstream proxy instances will be monitored for removal
from the load balancing pool.
properties:
baseEjectionTime:
description: The base time that a host is ejected
for. The real time is equal to the base time multiplied
by the number of times the host has been ejected
and is capped by max_ejection_time (Default 300s).
Defaults to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance
that a host will be actually ejected when an outlier
status is detected through consecutive 5xx. This
setting can be used to disable ejection or to ramp
it up slowly. Ex. Setting this to 10 will make it
a 10% chance that the host will be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis
sweeps. Each sweep may remove hosts or return hosts
to the pool. Ex. setting this to "10s" will set
the interval to 10 seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster
that can be ejected due to outlier detection. Defaults
to 10% but will eject at least one host regardless
of the value.
format: int32
type: integer
maxFailures:
description: MaxFailures is the count of consecutive
failures that results in a host being removed from
the pool.
format: int32
type: integer
type: object
requestHeaders:
description: Allow HTTP header manipulation to be configured.
properties:
Expand Down
13 changes: 10 additions & 3 deletions charts/consul/templates/crd-servicedefaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,18 +257,22 @@ spec:
The real time is equal to the base time multiplied by
the number of times the host has been ejected and is
capped by max_ejection_time (Default 300s). Defaults
to 30000ms or 30s.
to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance that
a host will be actually ejected when an outlier status
is detected through consecutive 5xx. This setting can
be used to disable ejection or to ramp it up slowly.
Ex. Setting this to 10 will make it a 10% chance that
the host will be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis sweeps.
Each sweep may remove hosts or return hosts to the pool.
Ex. setting this to "10s" will set the interval to 10
seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster that
Expand Down Expand Up @@ -370,19 +374,22 @@ spec:
The real time is equal to the base time multiplied
by the number of times the host has been ejected and
is capped by max_ejection_time (Default 300s). Defaults
to 30000ms or 30s.
to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance
that a host will be actually ejected when an outlier
status is detected through consecutive 5xx. This setting
can be used to disable ejection or to ramp it up slowly.
Ex. Setting this to 10 will make it a 10% chance that
the host will be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis
sweeps. Each sweep may remove hosts or return hosts
to the pool.
to the pool. Ex. setting this to "10s" will set the
interval to 10 seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster that
Expand Down
5 changes: 5 additions & 0 deletions control-plane/api/v1alpha1/ingressgateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ type IngressServiceConfig struct {
// will be allowed at a single point in time. Use this to limit HTTP/2 traffic,
// since HTTP/2 has many requests per connection.
MaxConcurrentRequests *uint32 `json:"maxConcurrentRequests,omitempty"`
// PassiveHealthCheck configuration determines how upstream proxy instances will
// be monitored for removal from the load balancing pool.
PassiveHealthCheck *PassiveHealthCheck `json:"passiveHealthCheck,omitempty"`
}

type GatewayTLSConfig struct {
Expand Down Expand Up @@ -361,6 +364,7 @@ func (in IngressService) toConsul() capi.IngressService {
MaxConnections: in.MaxConnections,
MaxPendingRequests: in.MaxPendingRequests,
MaxConcurrentRequests: in.MaxConcurrentRequests,
PassiveHealthCheck: in.PassiveHealthCheck.toConsul(),
}
}

Expand Down Expand Up @@ -465,5 +469,6 @@ func (in *IngressServiceConfig) toConsul() *capi.IngressServiceConfig {
MaxConnections: in.MaxConnections,
MaxPendingRequests: in.MaxPendingRequests,
MaxConcurrentRequests: in.MaxConcurrentRequests,
PassiveHealthCheck: in.PassiveHealthCheck.toConsul(),
}
}
37 changes: 37 additions & 0 deletions control-plane/api/v1alpha1/ingressgateway_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
)

func TestIngressGateway_MatchesConsul(t *testing.T) {
Expand Down Expand Up @@ -67,6 +68,17 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
PassiveHealthCheck: &PassiveHealthCheck{
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
MaxEjectionPercent: pointer.Uint32(10),
BaseEjectionTime: &metav1.Duration{
Duration: 10 * time.Second,
},
},
},
Listeners: []IngressListener{
{
Expand Down Expand Up @@ -167,6 +179,13 @@ func TestIngressGateway_MatchesConsul(t *testing.T) {
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
MaxEjectionPercent: pointer.Uint32(10),
BaseEjectionTime: pointer.Duration(10 * time.Second),
},
},
Listeners: []capi.IngressListener{
{
Expand Down Expand Up @@ -329,6 +348,17 @@ func TestIngressGateway_ToConsul(t *testing.T) {
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
PassiveHealthCheck: &PassiveHealthCheck{
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
MaxEjectionPercent: pointer.Uint32(10),
BaseEjectionTime: &metav1.Duration{
Duration: 10 * time.Second,
},
},
},
Listeners: []IngressListener{
{
Expand Down Expand Up @@ -428,6 +458,13 @@ func TestIngressGateway_ToConsul(t *testing.T) {
MaxConnections: &defaultMaxConnections,
MaxPendingRequests: &defaultMaxPendingRequests,
MaxConcurrentRequests: &defaultMaxConcurrentRequests,
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
MaxEjectionPercent: pointer.Uint32(10),
BaseEjectionTime: pointer.Duration(10 * time.Second),
},
},
Listeners: []capi.IngressListener{
{
Expand Down
6 changes: 4 additions & 2 deletions control-plane/api/v1alpha1/servicedefaults_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,23 @@ type UpstreamLimits struct {
// be monitored for removal from the load balancing pool.
type PassiveHealthCheck struct {
// Interval between health check analysis sweeps. Each sweep may remove
// hosts or return hosts to the pool.
// hosts or return hosts to the pool. Ex. setting this to "10s" will set
// the interval to 10 seconds.
Interval metav1.Duration `json:"interval,omitempty"`
// MaxFailures is the count of consecutive failures that results in a host
// being removed from the pool.
MaxFailures uint32 `json:"maxFailures,omitempty"`
// EnforcingConsecutive5xx is the % chance that a host will be actually ejected
// when an outlier status is detected through consecutive 5xx.
// This setting can be used to disable ejection or to ramp it up slowly.
// Ex. Setting this to 10 will make it a 10% chance that the host will be ejected.
EnforcingConsecutive5xx *uint32 `json:"enforcingConsecutive5xx,omitempty"`
// The maximum % of an upstream cluster that can be ejected due to outlier detection.
// Defaults to 10% but will eject at least one host regardless of the value.
MaxEjectionPercent *uint32 `json:"maxEjectionPercent,omitempty"`
// The base time that a host is ejected for. The real time is equal to the base time
// multiplied by the number of times the host has been ejected and is capped by
// max_ejection_time (Default 300s). Defaults to 30000ms or 30s.
// max_ejection_time (Default 300s). Defaults to 30s.
BaseEjectionTime *metav1.Duration `json:"baseEjectionTime,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,43 @@ spec:
while waiting for a connection to be established.
format: int32
type: integer
passiveHealthCheck:
description: PassiveHealthCheck configuration determines how upstream
proxy instances will be monitored for removal from the load
balancing pool.
properties:
baseEjectionTime:
description: The base time that a host is ejected for. The
real time is equal to the base time multiplied by the number
of times the host has been ejected and is capped by max_ejection_time
(Default 300s). Defaults to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance that
a host will be actually ejected when an outlier status is
detected through consecutive 5xx. This setting can be used
to disable ejection or to ramp it up slowly. Ex. Setting
this to 10 will make it a 10% chance that the host will
be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis sweeps.
Each sweep may remove hosts or return hosts to the pool.
Ex. setting this to "10s" will set the interval to 10 seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster that can
be ejected due to outlier detection. Defaults to 10% but
will eject at least one host regardless of the value.
format: int32
type: integer
maxFailures:
description: MaxFailures is the count of consecutive failures
that results in a host being removed from the pool.
format: int32
type: integer
type: object
type: object
listeners:
description: Listeners declares what ports the ingress gateway should
Expand Down Expand Up @@ -150,6 +187,47 @@ spec:
service is located. Partitioning is a Consul Enterprise
feature.
type: string
passiveHealthCheck:
description: PassiveHealthCheck configuration determines
how upstream proxy instances will be monitored for removal
from the load balancing pool.
properties:
baseEjectionTime:
description: The base time that a host is ejected
for. The real time is equal to the base time multiplied
by the number of times the host has been ejected
and is capped by max_ejection_time (Default 300s).
Defaults to 30s.
type: string
enforcingConsecutive5xx:
description: EnforcingConsecutive5xx is the % chance
that a host will be actually ejected when an outlier
status is detected through consecutive 5xx. This
setting can be used to disable ejection or to ramp
it up slowly. Ex. Setting this to 10 will make it
a 10% chance that the host will be ejected.
format: int32
type: integer
interval:
description: Interval between health check analysis
sweeps. Each sweep may remove hosts or return hosts
to the pool. Ex. setting this to "10s" will set
the interval to 10 seconds.
type: string
maxEjectionPercent:
description: The maximum % of an upstream cluster
that can be ejected due to outlier detection. Defaults
to 10% but will eject at least one host regardless
of the value.
format: int32
type: integer
maxFailures:
description: MaxFailures is the count of consecutive
failures that results in a host being removed from
the pool.
format: int32
type: integer
type: object
requestHeaders:
description: Allow HTTP header manipulation to be configured.
properties:
Expand Down
Loading