From 65322a1eb520590854c1611da6e318f293be0899 Mon Sep 17 00:00:00 2001 From: Maliz Date: Tue, 6 Sep 2022 14:24:30 -0700 Subject: [PATCH 1/5] update service config crds, update passive health check --- .../bases/crds-oss/servicedefaults.yaml | 1 + .../consul/templates/crd-servicedefaults.yaml | 14 +++++ .../api/v1alpha1/servicedefaults_types.go | 21 ++++++-- .../v1alpha1/servicedefaults_types_test.go | 52 ++++++++++++------- .../consul.hashicorp.com_servicedefaults.yaml | 14 +++++ control-plane/go.mod | 2 +- control-plane/go.sum | 2 + 7 files changed, 83 insertions(+), 23 deletions(-) diff --git a/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml b/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml index 6256790a80..648cc182de 100644 --- a/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml +++ b/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml @@ -18,6 +18,7 @@ spec: passiveHealthCheck: interval: 1s maxFailures: 10 + enforcing_consecutive_5xx: 60 - name: "bar" limits: maxConnections: 5 diff --git a/charts/consul/templates/crd-servicedefaults.yaml b/charts/consul/templates/crd-servicedefaults.yaml index f0ba18a616..636e8ce51f 100644 --- a/charts/consul/templates/crd-servicedefaults.yaml +++ b/charts/consul/templates/crd-servicedefaults.yaml @@ -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. @@ -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 diff --git a/control-plane/api/v1alpha1/servicedefaults_types.go b/control-plane/api/v1alpha1/servicedefaults_types.go index 325b80cefe..fb97bfea2e 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types.go +++ b/control-plane/api/v1alpha1/servicedefaults_types.go @@ -2,6 +2,9 @@ package v1alpha1 import ( "fmt" + "net" + "strings" + "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/consul-k8s/control-plane/api/common" @@ -12,8 +15,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" - "net" - "strings" ) const ( @@ -160,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 { @@ -386,9 +391,17 @@ func (in *PassiveHealthCheck) toConsul() *capi.PassiveHealthCheck { if in == nil { return nil } + + var enforcingConsecutive5xx uint32 + if in.EnforcingConsecutive5xx == nil { + enforcingConsecutive5xx = 100 + } else { + enforcingConsecutive5xx = *in.EnforcingConsecutive5xx + } return &capi.PassiveHealthCheck{ - Interval: in.Interval.Duration, - MaxFailures: in.MaxFailures, + Interval: in.Interval.Duration, + MaxFailures: in.MaxFailures, + EnforcingConsecutive5xx: enforcingConsecutive5xx, } } diff --git a/control-plane/api/v1alpha1/servicedefaults_types_test.go b/control-plane/api/v1alpha1/servicedefaults_types_test.go index 6c15c00c48..9605b127e4 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types_test.go +++ b/control-plane/api/v1alpha1/servicedefaults_types_test.go @@ -82,7 +82,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(20), + MaxFailures: uint32(20), + EnforcingConsecutive5xx: uint32Pointer(100), }, MeshGateway: MeshGateway{ Mode: "local", @@ -106,7 +107,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(10), + MaxFailures: uint32(10), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -129,7 +131,8 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(10), + MaxFailures: uint32(10), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -188,8 +191,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: uint32(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", @@ -210,8 +214,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: *uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -231,8 +236,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: uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -335,7 +341,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(20), + MaxFailures: uint32(20), + EnforcingConsecutive5xx: uint32Pointer(100), }, MeshGateway: MeshGateway{ Mode: "local", @@ -358,7 +365,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(10), + MaxFailures: uint32(10), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -380,7 +388,8 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Interval: metav1.Duration{ Duration: 2 * time.Second, }, - MaxFailures: uint32(10), + MaxFailures: uint32(10), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -436,8 +445,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: *uint32Pointer(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", @@ -457,8 +467,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: *uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -477,8 +488,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: uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -1027,3 +1039,7 @@ func TestServiceDefaults_ObjectMeta(t *testing.T) { func intPointer(i int) *int { return &i } + +func uint32Pointer(i uint32) *uint32 { + return &i +} diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml index 67f33517ba..ae815fce47 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml @@ -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. @@ -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 diff --git a/control-plane/go.mod b/control-plane/go.mod index 50b1c65a2e..f8727ad1be 100644 --- a/control-plane/go.mod +++ b/control-plane/go.mod @@ -8,7 +8,7 @@ require ( 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.20220822180451-60c82757ea35 + github.com/hashicorp/consul/api v1.10.1-0.20220906101351-9675faeab570 github.com/hashicorp/consul/sdk v0.11.0 github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f github.com/hashicorp/go-hclog v0.16.1 diff --git a/control-plane/go.sum b/control-plane/go.sum index 3d48c2626a..506e1dafac 100644 --- a/control-plane/go.sum +++ b/control-plane/go.sum @@ -342,6 +342,8 @@ github.com/hashicorp/consul-k8s/control-plane/cni v0.0.0-20220831174802-b8af6526 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/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.4.1-0.20220801192236-988e1fd35d51/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw= github.com/hashicorp/consul/sdk v0.11.0 h1:HRzj8YSCln2yGgCumN5CL8lYlD3gBurnervJRJAZyC4= From 0f3622c937d15f933db8002a79a0dffc67c45ef0 Mon Sep 17 00:00:00 2001 From: Maliz Date: Tue, 13 Sep 2022 14:29:54 -0700 Subject: [PATCH 2/5] get latest type changes from consul api, address comments --- .../fixtures/bases/crds-oss/servicedefaults.yaml | 2 +- control-plane/api/v1alpha1/servicedefaults_types.go | 8 +------- .../api/v1alpha1/servicedefaults_types_test.go | 12 ++++++------ control-plane/go.mod | 2 +- control-plane/go.sum | 2 ++ 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml b/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml index 648cc182de..7b5f23eff5 100644 --- a/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml +++ b/acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml @@ -18,7 +18,7 @@ spec: passiveHealthCheck: interval: 1s maxFailures: 10 - enforcing_consecutive_5xx: 60 + enforcing_consecutive_5xx: 60 - name: "bar" limits: maxConnections: 5 diff --git a/control-plane/api/v1alpha1/servicedefaults_types.go b/control-plane/api/v1alpha1/servicedefaults_types.go index fb97bfea2e..ae0cbb039c 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types.go +++ b/control-plane/api/v1alpha1/servicedefaults_types.go @@ -392,16 +392,10 @@ func (in *PassiveHealthCheck) toConsul() *capi.PassiveHealthCheck { return nil } - var enforcingConsecutive5xx uint32 - if in.EnforcingConsecutive5xx == nil { - enforcingConsecutive5xx = 100 - } else { - enforcingConsecutive5xx = *in.EnforcingConsecutive5xx - } return &capi.PassiveHealthCheck{ Interval: in.Interval.Duration, MaxFailures: in.MaxFailures, - EnforcingConsecutive5xx: enforcingConsecutive5xx, + EnforcingConsecutive5xx: in.EnforcingConsecutive5xx, } } diff --git a/control-plane/api/v1alpha1/servicedefaults_types_test.go b/control-plane/api/v1alpha1/servicedefaults_types_test.go index 9605b127e4..7a2e5e3840 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types_test.go +++ b/control-plane/api/v1alpha1/servicedefaults_types_test.go @@ -193,7 +193,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(20), - EnforcingConsecutive5xx: uint32(100), + EnforcingConsecutive5xx: uint32Pointer(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", @@ -216,7 +216,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: *uint32Pointer(60), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -238,7 +238,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32(60), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -447,7 +447,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(20), - EnforcingConsecutive5xx: *uint32Pointer(100), + EnforcingConsecutive5xx: uint32Pointer(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", @@ -469,7 +469,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: *uint32Pointer(60), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -490,7 +490,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32(60), + EnforcingConsecutive5xx: uint32Pointer(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", diff --git a/control-plane/go.mod b/control-plane/go.mod index f8727ad1be..4c54b49456 100644 --- a/control-plane/go.mod +++ b/control-plane/go.mod @@ -8,7 +8,7 @@ require ( 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.20220906101351-9675faeab570 + github.com/hashicorp/consul/api v1.10.1-0.20220913205944-e743eefbd104 github.com/hashicorp/consul/sdk v0.11.0 github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f github.com/hashicorp/go-hclog v0.16.1 diff --git a/control-plane/go.sum b/control-plane/go.sum index 506e1dafac..ea9bc062d4 100644 --- a/control-plane/go.sum +++ b/control-plane/go.sum @@ -344,6 +344,8 @@ github.com/hashicorp/consul/api v1.10.1-0.20220822180451-60c82757ea35 h1:csNww5q 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/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.4.1-0.20220801192236-988e1fd35d51/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw= github.com/hashicorp/consul/sdk v0.11.0 h1:HRzj8YSCln2yGgCumN5CL8lYlD3gBurnervJRJAZyC4= From 3112e09cb11582cddef5842b0702281bd03ca5d2 Mon Sep 17 00:00:00 2001 From: malizz Date: Tue, 13 Sep 2022 15:25:28 -0700 Subject: [PATCH 3/5] Update control-plane/api/v1alpha1/servicedefaults_types_test.go Co-authored-by: Kyle Schochenmaier --- control-plane/api/v1alpha1/servicedefaults_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control-plane/api/v1alpha1/servicedefaults_types_test.go b/control-plane/api/v1alpha1/servicedefaults_types_test.go index 7a2e5e3840..4a45093144 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types_test.go +++ b/control-plane/api/v1alpha1/servicedefaults_types_test.go @@ -193,7 +193,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(20), - EnforcingConsecutive5xx: uint32Pointer(100), + EnforcingConsecutive5xx: pointer.Uint32(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", From 3f2828630ab3656336bf1209f2652c27ee1ce53f Mon Sep 17 00:00:00 2001 From: Maliz Date: Tue, 13 Sep 2022 15:30:11 -0700 Subject: [PATCH 4/5] replace pointer func calls with library function --- .../v1alpha1/servicedefaults_types_test.go | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/control-plane/api/v1alpha1/servicedefaults_types_test.go b/control-plane/api/v1alpha1/servicedefaults_types_test.go index 4a45093144..91888b5482 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types_test.go +++ b/control-plane/api/v1alpha1/servicedefaults_types_test.go @@ -83,7 +83,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(20), - EnforcingConsecutive5xx: uint32Pointer(100), + EnforcingConsecutive5xx: pointer.Uint32(100), }, MeshGateway: MeshGateway{ Mode: "local", @@ -108,7 +108,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -132,7 +132,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -216,7 +216,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -238,7 +238,7 @@ func TestServiceDefaults_ToConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -342,7 +342,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(20), - EnforcingConsecutive5xx: uint32Pointer(100), + EnforcingConsecutive5xx: pointer.Uint32(100), }, MeshGateway: MeshGateway{ Mode: "local", @@ -366,7 +366,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -389,7 +389,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { Duration: 2 * time.Second, }, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: MeshGateway{ Mode: "remote", @@ -447,7 +447,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(20), - EnforcingConsecutive5xx: uint32Pointer(100), + EnforcingConsecutive5xx: pointer.Uint32(100), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "local", @@ -469,7 +469,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -490,7 +490,7 @@ func TestServiceDefaults_MatchesConsul(t *testing.T) { PassiveHealthCheck: &capi.PassiveHealthCheck{ Interval: 2 * time.Second, MaxFailures: uint32(10), - EnforcingConsecutive5xx: uint32Pointer(60), + EnforcingConsecutive5xx: pointer.Uint32(60), }, MeshGateway: capi.MeshGatewayConfig{ Mode: "remote", @@ -1039,7 +1039,3 @@ func TestServiceDefaults_ObjectMeta(t *testing.T) { func intPointer(i int) *int { return &i } - -func uint32Pointer(i uint32) *uint32 { - return &i -} From 30544f5fb3800b49568656e052e4ff24ab567cc1 Mon Sep 17 00:00:00 2001 From: Maliz Date: Tue, 13 Sep 2022 15:46:40 -0700 Subject: [PATCH 5/5] fix import --- control-plane/api/v1alpha1/servicedefaults_types_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/control-plane/api/v1alpha1/servicedefaults_types_test.go b/control-plane/api/v1alpha1/servicedefaults_types_test.go index 91888b5482..c70c8a6408 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types_test.go +++ b/control-plane/api/v1alpha1/servicedefaults_types_test.go @@ -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) {