Skip to content

Commit

Permalink
get latest type changes from consul api, address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Maliz committed Sep 13, 2022
1 parent 65322a1 commit 0f3622c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
passiveHealthCheck:
interval: 1s
maxFailures: 10
enforcing_consecutive_5xx: 60
enforcing_consecutive_5xx: 60
- name: "bar"
limits:
maxConnections: 5
Expand Down
8 changes: 1 addition & 7 deletions control-plane/api/v1alpha1/servicedefaults_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
12 changes: 6 additions & 6 deletions control-plane/api/v1alpha1/servicedefaults_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion control-plane/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions control-plane/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 0f3622c

Please sign in to comment.