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

update service config crds, update passive health check #1484

Merged
merged 7 commits into from
Sep 29, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
passiveHealthCheck:
interval: 1s
maxFailures: 10
enforcing_consecutive_5xx: 60
- name: "bar"
limits:
maxConnections: 5
Expand Down
14 changes: 14 additions & 0 deletions charts/consul/templates/crd-servicedefaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ spec:
upstream proxy instances will be monitored for removal from
the load balancing pool.
properties:
enforcing_consecutive_5xx:
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.
format: int32
type: integer
interval:
description: Interval between health check analysis sweeps.
Each sweep may remove hosts or return hosts to the pool.
Expand Down Expand Up @@ -333,6 +340,13 @@ spec:
how upstream proxy instances will be monitored for removal
from the load balancing pool.
properties:
enforcing_consecutive_5xx:
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.
format: int32
type: integer
interval:
description: Interval between health check analysis
sweeps. Each sweep may remove hosts or return hosts
Expand Down
10 changes: 8 additions & 2 deletions control-plane/api/v1alpha1/servicedefaults_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ type PassiveHealthCheck struct {
// 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.
EnforcingConsecutive5xx *uint32 `json:"enforcing_consecutive_5xx,omitempty"`
}

type ServiceDefaultsDestination struct {
Expand Down Expand Up @@ -387,9 +391,11 @@ func (in *PassiveHealthCheck) toConsul() *capi.PassiveHealthCheck {
if in == nil {
return nil
}

return &capi.PassiveHealthCheck{
Interval: in.Interval.Duration,
MaxFailures: in.MaxFailures,
Interval: in.Interval.Duration,
MaxFailures: in.MaxFailures,
EnforcingConsecutive5xx: in.EnforcingConsecutive5xx,
}
}

Expand Down
49 changes: 31 additions & 18 deletions control-plane/api/v1alpha1/servicedefaults_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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 TestServiceDefaults_ToConsul(t *testing.T) {
Expand Down Expand Up @@ -82,7 +83,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(20),
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
},
MeshGateway: MeshGateway{
Mode: "local",
Expand All @@ -106,7 +108,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(10),
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: MeshGateway{
Mode: "remote",
Expand All @@ -129,7 +132,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(10),
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: MeshGateway{
Mode: "remote",
Expand Down Expand Up @@ -188,8 +192,9 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(10),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(20),
Interval: 2 * time.Second,
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "local",
Expand All @@ -210,8 +215,9 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(5),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(10),
Interval: 2 * time.Second,
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "remote",
Expand All @@ -231,8 +237,9 @@ func TestServiceDefaults_ToConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(2),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(10),
Interval: 2 * time.Second,
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "remote",
Expand Down Expand Up @@ -335,7 +342,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(20),
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
},
MeshGateway: MeshGateway{
Mode: "local",
Expand All @@ -358,7 +366,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(10),
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: MeshGateway{
Mode: "remote",
Expand All @@ -380,7 +389,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
Interval: metav1.Duration{
Duration: 2 * time.Second,
},
MaxFailures: uint32(10),
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: MeshGateway{
Mode: "remote",
Expand Down Expand Up @@ -436,8 +446,9 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(10),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(20),
Interval: 2 * time.Second,
MaxFailures: uint32(20),
EnforcingConsecutive5xx: pointer.Uint32(100),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "local",
Expand All @@ -457,8 +468,9 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(5),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(10),
Interval: 2 * time.Second,
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "remote",
Expand All @@ -477,8 +489,9 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) {
MaxConcurrentRequests: intPointer(2),
},
PassiveHealthCheck: &capi.PassiveHealthCheck{
Interval: 2 * time.Second,
MaxFailures: uint32(10),
Interval: 2 * time.Second,
MaxFailures: uint32(10),
EnforcingConsecutive5xx: pointer.Uint32(60),
},
MeshGateway: capi.MeshGatewayConfig{
Mode: "remote",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ spec:
upstream proxy instances will be monitored for removal from
the load balancing pool.
properties:
enforcing_consecutive_5xx:
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.
format: int32
type: integer
interval:
description: Interval between health check analysis sweeps.
Each sweep may remove hosts or return hosts to the pool.
Expand Down Expand Up @@ -326,6 +333,13 @@ spec:
how upstream proxy instances will be monitored for removal
from the load balancing pool.
properties:
enforcing_consecutive_5xx:
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.
format: int32
type: integer
interval:
description: Interval between health check analysis
sweeps. Each sweep may remove hosts or return hosts
Expand Down
3 changes: 2 additions & 1 deletion control-plane/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ require (
github.com/fsnotify/fsnotify v1.5.4
github.com/go-logr/logr v0.4.0
github.com/google/go-cmp v0.5.7
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/hashicorp/consul/api v1.10.1-0.20220913205944-e743eefbd104
github.com/hashicorp/consul-k8s/control-plane/cni v0.0.0-20220831174802-b8af65262de8
github.com/hashicorp/consul-server-connection-manager v0.0.0-20220922180412-01c5be1c636f
github.com/hashicorp/consul/api v1.10.1-0.20220822180451-60c82757ea35
github.com/hashicorp/consul/sdk v0.11.0
github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f
github.com/hashicorp/go-hclog v1.2.2
Expand Down
5 changes: 4 additions & 1 deletion control-plane/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@ github.com/hashicorp/consul-server-connection-manager v0.0.0-20220922180412-01c5
github.com/hashicorp/consul-server-connection-manager v0.0.0-20220922180412-01c5be1c636f/go.mod h1:I56VZ1V7WN8/oPHswKDywfepvD7rB1RrTE4fRrNz3Wc=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.10.1-0.20220822180451-60c82757ea35 h1:csNww5qBHaFqsX1eMEKVvmJ4dhqcXWj0sCkbccsSsHc=
github.com/hashicorp/consul/api v1.10.1-0.20220822180451-60c82757ea35/go.mod h1:bcaw5CSZ7NE9qfOfKCI1xb7ZKjzu/MyvQkCLTfqLqxQ=
github.com/hashicorp/consul/api v1.10.1-0.20220906101351-9675faeab570 h1:ckegGAL9YceZ24TcQmcrqeUPwb2u/mRm5/XAZZhE9XE=
github.com/hashicorp/consul/api v1.10.1-0.20220906101351-9675faeab570/go.mod h1:bcaw5CSZ7NE9qfOfKCI1xb7ZKjzu/MyvQkCLTfqLqxQ=
github.com/hashicorp/consul/api v1.10.1-0.20220913205944-e743eefbd104 h1:NW0jZq0suX2gfHVFmKuJ5DGLXSP7qN9FmjQOU764fFQ=
github.com/hashicorp/consul/api v1.10.1-0.20220913205944-e743eefbd104/go.mod h1:bcaw5CSZ7NE9qfOfKCI1xb7ZKjzu/MyvQkCLTfqLqxQ=
github.com/hashicorp/consul/proto-public v0.1.0 h1:O0LSmCqydZi363hsqc6n2v5sMz3usQMXZF6ziK3SzXU=
github.com/hashicorp/consul/proto-public v0.1.0/go.mod h1:vs2KkuWwtjkIgA5ezp4YKPzQp4GitV+q/+PvksrA92k=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
Expand Down