Skip to content
Open
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
4 changes: 2 additions & 2 deletions pkg/providers/v1/aws_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ func (c *Cloud) ensureLoadBalancerHealthCheck(ctx context.Context, loadBalancer
actual := loadBalancer.HealthCheck
// Override healthcheck protocol, port and path based on annotations
if s, ok := annotations[ServiceAnnotationLoadBalancerHealthCheckProtocol]; ok {
protocol = s
protocol = strings.ToUpper(s)
}
if s, ok := annotations[ServiceAnnotationLoadBalancerHealthCheckPort]; ok && s != defaultHealthCheckPort {
p, err := strconv.ParseInt(s, 10, 0)
Expand All @@ -1394,7 +1394,7 @@ func (c *Cloud) ensureLoadBalancerHealthCheck(ctx context.Context, loadBalancer
}
port = int32(p)
}
switch strings.ToUpper(protocol) {
switch protocol {
case "HTTP", "HTTPS":
if path == "" {
path = defaultHealthCheckPath
Expand Down
13 changes: 13 additions & 0 deletions pkg/providers/v1/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,19 @@ func TestEnsureLoadBalancerHealthCheck(t *testing.T) {
Target: aws.String("TCP:8080"),
},
},
{
name: "healthcheck protocol written lowercase should be converted to uppercase",
annotations: map[string]string{
ServiceAnnotationLoadBalancerHealthCheckProtocol: "tcp",
},
want: elbtypes.HealthCheck{
HealthyThreshold: aws.Int32(2),
UnhealthyThreshold: aws.Int32(6),
Timeout: aws.Int32(5),
Interval: aws.Int32(10),
Target: aws.String("TCP:8080"),
},
},
}
lbName := "myLB"
// this HC will always differ from the expected HC and thus it is expected an
Expand Down