Skip to content

Commit 1d6d1d9

Browse files
fix health check protocol for UDP
(cherry picked from commit 9d022bd)
1 parent aaaf649 commit 1d6d1d9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pkg/cloudprovider/huaweicloud/dedicatedloadbalancer.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ func (d *DedicatedLoadBalancer) updateListener(listener *elbmodel.Listener, serv
352352
d.loadbalancerOpts.EnableTransparentClientIP)
353353
if transparentClientIPEnable {
354354
updateOpts.TransparentClientIpEnable = &transparentClientIPEnable
355-
} else if protocol == ProtocolUDP || protocol == ProtocolTCP {
356-
updateOpts.TransparentClientIpEnable = &transparentClientIPEnable
357355
}
358356

359357
if timeout := getIntFromSvsAnnotation(service, ElbIdleTimeout, d.loadbalancerOpts.IdleTimeout); timeout != 0 {
@@ -698,8 +696,13 @@ func (d *DedicatedLoadBalancer) ensureHealthCheck(loadbalancerID string, pool *e
698696
return nil
699697
}
700698

701-
func (d *DedicatedLoadBalancer) updateHealthMonitor(id string, protocol v1.Protocol, opts *config.HealthCheckOption,
702-
) error {
699+
func (d *DedicatedLoadBalancer) updateHealthMonitor(id string, protocol v1.Protocol, opts *config.HealthCheckOption) error {
700+
if protocol == ProtocolHTTPS || protocol == ProtocolTerminatedHTTPS {
701+
protocol = ProtocolHTTP
702+
} else if protocol == ProtocolUDP {
703+
protocol = "UDP_CONNECT"
704+
}
705+
703706
monitorProtocol := string(protocol)
704707
if protocol == v1.ProtocolSCTP {
705708
return status.Errorf(codes.InvalidArgument, "Protocol SCTP not supported")
@@ -714,6 +717,12 @@ func (d *DedicatedLoadBalancer) updateHealthMonitor(id string, protocol v1.Proto
714717
}
715718

716719
func (d *DedicatedLoadBalancer) createHealthMonitor(loadbalancerID, poolID, protocol string, opts *config.HealthCheckOption) (*elbmodel.HealthMonitor, error) {
720+
if protocol == ProtocolHTTPS || protocol == ProtocolTerminatedHTTPS {
721+
protocol = ProtocolHTTP
722+
} else if protocol == ProtocolUDP {
723+
protocol = "UDP_CONNECT"
724+
}
725+
717726
monitor, err := d.dedicatedELBClient.CreateHealthMonitor(&elbmodel.CreateHealthMonitorOption{
718727
PoolId: poolID,
719728
Type: protocol,

0 commit comments

Comments
 (0)