Skip to content

Commit 74e869c

Browse files
committed
fix: compare string value of protocol in health check instead of pointer
1 parent 562020d commit 74e869c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/cloud/services/elb/loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ func (s *Service) getHealthCheckTarget() string {
14381438
protocol := &infrav1.ELBProtocolSSL
14391439
if controlPlaneELB != nil && controlPlaneELB.HealthCheckProtocol != nil {
14401440
protocol = controlPlaneELB.HealthCheckProtocol
1441-
if protocol == &infrav1.ELBProtocolHTTP || protocol == &infrav1.ELBProtocolHTTPS {
1441+
if protocol.String() == infrav1.ELBProtocolHTTP.String() || protocol.String() == infrav1.ELBProtocolHTTPS.String() {
14421442
return fmt.Sprintf("%v:%d/readyz", protocol, infrav1.DefaultAPIServerPort)
14431443
}
14441444
}

pkg/cloud/services/elb/loadbalancer_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,10 @@ func TestChunkELBs(t *testing.T) {
23172317
}
23182318

23192319
func TestGetHealthCheckProtocol(t *testing.T) {
2320+
testHTTP := infrav1.ELBProtocol("HTTP")
2321+
testHTTPS := infrav1.ELBProtocol("HTTPS")
2322+
testTCP := infrav1.ELBProtocol("TCP")
2323+
23202324
tests := []struct {
23212325
testName string
23222326
lbSpec *infrav1.AWSLoadBalancerSpec
@@ -2330,21 +2334,21 @@ func TestGetHealthCheckProtocol(t *testing.T) {
23302334
{
23312335
"protocol http",
23322336
&infrav1.AWSLoadBalancerSpec{
2333-
HealthCheckProtocol: &infrav1.ELBProtocolHTTP,
2337+
HealthCheckProtocol: &testHTTP,
23342338
},
23352339
"HTTP:6443/readyz",
23362340
},
23372341
{
23382342
"protocol https",
23392343
&infrav1.AWSLoadBalancerSpec{
2340-
HealthCheckProtocol: &infrav1.ELBProtocolHTTPS,
2344+
HealthCheckProtocol: &testHTTPS,
23412345
},
23422346
"HTTPS:6443/readyz",
23432347
},
23442348
{
23452349
"protocol tcp",
23462350
&infrav1.AWSLoadBalancerSpec{
2347-
HealthCheckProtocol: &infrav1.ELBProtocolTCP,
2351+
HealthCheckProtocol: &testTCP,
23482352
},
23492353
"TCP:6443",
23502354
},

0 commit comments

Comments
 (0)