@@ -87,12 +87,13 @@ const (
8787 ServiceAnnotationLoadBalancerAvailabilityZone = "loadbalancer.openstack.org/availability-zone"
8888 // ServiceAnnotationLoadBalancerEnableHealthMonitor defines whether to create health monitor for the load balancer
8989 // pool, if not specified, use 'create-monitor' config. The health monitor can be created or deleted dynamically.
90- ServiceAnnotationLoadBalancerEnableHealthMonitor = "loadbalancer.openstack.org/enable-health-monitor"
91- ServiceAnnotationLoadBalancerHealthMonitorDelay = "loadbalancer.openstack.org/health-monitor-delay"
92- ServiceAnnotationLoadBalancerHealthMonitorTimeout = "loadbalancer.openstack.org/health-monitor-timeout"
93- ServiceAnnotationLoadBalancerHealthMonitorMaxRetries = "loadbalancer.openstack.org/health-monitor-max-retries"
94- ServiceAnnotationLoadBalancerLoadbalancerHostname = "loadbalancer.openstack.org/hostname"
95- ServiceAnnotationLoadBalancerAddress = "loadbalancer.openstack.org/load-balancer-address"
90+ ServiceAnnotationLoadBalancerEnableHealthMonitor = "loadbalancer.openstack.org/enable-health-monitor"
91+ ServiceAnnotationLoadBalancerHealthMonitorDelay = "loadbalancer.openstack.org/health-monitor-delay"
92+ ServiceAnnotationLoadBalancerHealthMonitorTimeout = "loadbalancer.openstack.org/health-monitor-timeout"
93+ ServiceAnnotationLoadBalancerHealthMonitorMaxRetries = "loadbalancer.openstack.org/health-monitor-max-retries"
94+ ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown = "loadbalancer.openstack.org/health-monitor-max-retries-down"
95+ ServiceAnnotationLoadBalancerLoadbalancerHostname = "loadbalancer.openstack.org/hostname"
96+ ServiceAnnotationLoadBalancerAddress = "loadbalancer.openstack.org/load-balancer-address"
9697 // revive:disable:var-naming
9798 ServiceAnnotationTlsContainerRef = "loadbalancer.openstack.org/default-tls-container-ref"
9899 // revive:enable:var-naming
@@ -324,33 +325,34 @@ func tagList(tags string) ([]string, bool, bool) {
324325
325326// serviceConfig contains configurations for creating a Service.
326327type serviceConfig struct {
327- internal bool
328- connLimit int
329- configClassName string
330- lbNetworkID string
331- lbSubnetID string
332- lbMemberSubnetID string
333- lbPublicNetworkID string
334- lbPublicSubnetSpec * floatingSubnetSpec
335- keepClientIP bool
336- enableProxyProtocol bool
337- timeoutClientData int
338- timeoutMemberConnect int
339- timeoutMemberData int
340- timeoutTCPInspect int
341- allowedCIDR []string
342- enableMonitor bool
343- flavorID string
344- availabilityZone string
345- tlsContainerRef string
346- lbID string
347- lbName string
348- supportLBTags bool
349- healthCheckNodePort int
350- healthMonitorDelay int
351- healthMonitorTimeout int
352- healthMonitorMaxRetries int
353- preferredIPFamily corev1.IPFamily // preferred (the first) IP family indicated in service's `spec.ipFamilies`
328+ internal bool
329+ connLimit int
330+ configClassName string
331+ lbNetworkID string
332+ lbSubnetID string
333+ lbMemberSubnetID string
334+ lbPublicNetworkID string
335+ lbPublicSubnetSpec * floatingSubnetSpec
336+ keepClientIP bool
337+ enableProxyProtocol bool
338+ timeoutClientData int
339+ timeoutMemberConnect int
340+ timeoutMemberData int
341+ timeoutTCPInspect int
342+ allowedCIDR []string
343+ enableMonitor bool
344+ flavorID string
345+ availabilityZone string
346+ tlsContainerRef string
347+ lbID string
348+ lbName string
349+ supportLBTags bool
350+ healthCheckNodePort int
351+ healthMonitorDelay int
352+ healthMonitorTimeout int
353+ healthMonitorMaxRetries int
354+ healthMonitorMaxRetriesDown int
355+ preferredIPFamily corev1.IPFamily // preferred (the first) IP family indicated in service's `spec.ipFamilies`
354356}
355357
356358type listenerKey struct {
@@ -1051,11 +1053,15 @@ func (lbaas *LbaasV2) ensureOctaviaHealthMonitor(lbID string, name string, pool
10511053 }
10521054 monitorID = ""
10531055 }
1054- if svcConf .healthMonitorDelay != monitor .Delay || svcConf .healthMonitorTimeout != monitor .Timeout || svcConf .healthMonitorMaxRetries != monitor .MaxRetries {
1056+ if svcConf .healthMonitorDelay != monitor .Delay ||
1057+ svcConf .healthMonitorTimeout != monitor .Timeout ||
1058+ svcConf .healthMonitorMaxRetries != monitor .MaxRetries ||
1059+ svcConf .healthMonitorMaxRetriesDown != monitor .MaxRetriesDown {
10551060 updateOpts := v2monitors.UpdateOpts {
1056- Delay : svcConf .healthMonitorDelay ,
1057- Timeout : svcConf .healthMonitorTimeout ,
1058- MaxRetries : svcConf .healthMonitorMaxRetries ,
1061+ Delay : svcConf .healthMonitorDelay ,
1062+ Timeout : svcConf .healthMonitorTimeout ,
1063+ MaxRetries : svcConf .healthMonitorMaxRetries ,
1064+ MaxRetriesDown : svcConf .healthMonitorMaxRetriesDown ,
10591065 }
10601066 klog .Infof ("Updating health monitor %s updateOpts %+v" , monitorID , updateOpts )
10611067 if err := openstackutil .UpdateHealthMonitor (lbaas .lb , monitorID , updateOpts , lbID ); err != nil {
@@ -1102,10 +1108,11 @@ func (lbaas *LbaasV2) canUseHTTPMonitor(port corev1.ServicePort) bool {
11021108// buildMonitorCreateOpts returns a v2monitors.CreateOpts without PoolID for consumption of both, fully popuplated Loadbalancers and Monitors.
11031109func (lbaas * LbaasV2 ) buildMonitorCreateOpts (svcConf * serviceConfig , port corev1.ServicePort ) v2monitors.CreateOpts {
11041110 opts := v2monitors.CreateOpts {
1105- Type : string (port .Protocol ),
1106- Delay : svcConf .healthMonitorDelay ,
1107- Timeout : svcConf .healthMonitorTimeout ,
1108- MaxRetries : svcConf .healthMonitorMaxRetries ,
1111+ Type : string (port .Protocol ),
1112+ Delay : svcConf .healthMonitorDelay ,
1113+ Timeout : svcConf .healthMonitorTimeout ,
1114+ MaxRetries : svcConf .healthMonitorMaxRetries ,
1115+ MaxRetriesDown : svcConf .healthMonitorMaxRetriesDown ,
11091116 }
11101117 if port .Protocol == corev1 .ProtocolUDP {
11111118 opts .Type = "UDP-CONNECT"
@@ -1552,6 +1559,7 @@ func (lbaas *LbaasV2) checkServiceUpdate(service *corev1.Service, nodes []*corev
15521559 svcConf .healthMonitorDelay = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorDelay , int (lbaas .opts .MonitorDelay .Duration .Seconds ()))
15531560 svcConf .healthMonitorTimeout = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorTimeout , int (lbaas .opts .MonitorTimeout .Duration .Seconds ()))
15541561 svcConf .healthMonitorMaxRetries = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetries , int (lbaas .opts .MonitorMaxRetries ))
1562+ svcConf .healthMonitorMaxRetriesDown = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown , int (lbaas .opts .MonitorMaxRetriesDown ))
15551563 return nil
15561564}
15571565
@@ -1786,6 +1794,7 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node
17861794 svcConf .healthMonitorDelay = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorDelay , int (lbaas .opts .MonitorDelay .Duration .Seconds ()))
17871795 svcConf .healthMonitorTimeout = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorTimeout , int (lbaas .opts .MonitorTimeout .Duration .Seconds ()))
17881796 svcConf .healthMonitorMaxRetries = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetries , int (lbaas .opts .MonitorMaxRetries ))
1797+ svcConf .healthMonitorMaxRetriesDown = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown , int (lbaas .opts .MonitorMaxRetriesDown ))
17891798 return nil
17901799}
17911800
0 commit comments