From 9e0b8e745914319df28d6aaa7ae206c285cd7733 Mon Sep 17 00:00:00 2001 From: Kishor Joshi Date: Fri, 6 Nov 2020 09:20:39 -0800 Subject: [PATCH 1/3] Less restrictions for AWS NLB health check config --- staging/src/k8s.io/legacy-cloud-providers/aws/aws.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go index 93e9a6603e1..c74eef1199f 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go +++ b/staging/src/k8s.io/legacy-cloud-providers/aws/aws.go @@ -3771,14 +3771,6 @@ func (c *Cloud) buildNLBHealthCheckConfiguration(svc *v1.Service) (healthCheckCo return healthCheckConfig{}, err } - if hc.HealthyThreshold != hc.UnhealthyThreshold { - return healthCheckConfig{}, fmt.Errorf("Health check healthy threshold and unhealthy threshold must be equal") - } - - if hc.Interval != 10 && hc.Interval != 30 { - return healthCheckConfig{}, fmt.Errorf("Invalid health check interval '%v', must be either 10 or 30", hc.Interval) - } - if hc.Port != defaultHealthCheckPort { if _, err := strconv.ParseInt(hc.Port, 10, 0); err != nil { return healthCheckConfig{}, fmt.Errorf("Invalid health check port '%v'", hc.Port) From f784eb3cfd051da66332484f71287563ad5d7e8a Mon Sep 17 00:00:00 2001 From: Kishor Joshi Date: Fri, 6 Nov 2020 11:11:46 -0800 Subject: [PATCH 2/3] Update UTs --- .../legacy-cloud-providers/aws/aws_test.go | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go index 1b04429d8e6..f40dc2e5142 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go @@ -2961,7 +2961,7 @@ func TestCloud_buildNLBHealthCheckConfiguration(t *testing.T) { wantError: false, }, { - name: "invalid interval", + name: "interval not 10 or 30", service: &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "test-svc", @@ -2982,8 +2982,15 @@ func TestCloud_buildNLBHealthCheckConfiguration(t *testing.T) { }, }, }, - want: healthCheckConfig{}, - wantError: true, + want: healthCheckConfig{ + Port: "traffic-port", + Protocol: elbv2.ProtocolEnumTcp, + Interval: 23, + Timeout: 10, + HealthyThreshold: 3, + UnhealthyThreshold: 3, + }, + wantError: false, }, { name: "invalid timeout", @@ -3033,8 +3040,15 @@ func TestCloud_buildNLBHealthCheckConfiguration(t *testing.T) { }, }, }, - want: healthCheckConfig{}, - wantError: true, + want: healthCheckConfig{ + Port: "traffic-port", + Protocol: elbv2.ProtocolEnumTcp, + Interval: 30, + Timeout: 10, + HealthyThreshold: 7, + UnhealthyThreshold: 5, + }, + wantError: false, }, } From 7f03de32ad1ad30ddd7968640646c5e8fd3c83bb Mon Sep 17 00:00:00 2001 From: Kishor Joshi Date: Fri, 6 Nov 2020 13:38:38 -0800 Subject: [PATCH 3/3] fix formatting --- staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go index f40dc2e5142..56fd43dd12c 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/aws/aws_test.go @@ -3040,7 +3040,7 @@ func TestCloud_buildNLBHealthCheckConfiguration(t *testing.T) { }, }, }, - want: healthCheckConfig{ + want: healthCheckConfig{ Port: "traffic-port", Protocol: elbv2.ProtocolEnumTcp, Interval: 30,