@@ -88,12 +88,13 @@ const (
88
88
ServiceAnnotationLoadBalancerAvailabilityZone = "loadbalancer.openstack.org/availability-zone"
89
89
// ServiceAnnotationLoadBalancerEnableHealthMonitor defines whether to create health monitor for the load balancer
90
90
// pool, if not specified, use 'create-monitor' config. The health monitor can be created or deleted dynamically.
91
- ServiceAnnotationLoadBalancerEnableHealthMonitor = "loadbalancer.openstack.org/enable-health-monitor"
92
- ServiceAnnotationLoadBalancerHealthMonitorDelay = "loadbalancer.openstack.org/health-monitor-delay"
93
- ServiceAnnotationLoadBalancerHealthMonitorTimeout = "loadbalancer.openstack.org/health-monitor-timeout"
94
- ServiceAnnotationLoadBalancerHealthMonitorMaxRetries = "loadbalancer.openstack.org/health-monitor-max-retries"
95
- ServiceAnnotationLoadBalancerLoadbalancerHostname = "loadbalancer.openstack.org/hostname"
96
- ServiceAnnotationLoadBalancerAddress = "loadbalancer.openstack.org/load-balancer-address"
91
+ ServiceAnnotationLoadBalancerEnableHealthMonitor = "loadbalancer.openstack.org/enable-health-monitor"
92
+ ServiceAnnotationLoadBalancerHealthMonitorDelay = "loadbalancer.openstack.org/health-monitor-delay"
93
+ ServiceAnnotationLoadBalancerHealthMonitorTimeout = "loadbalancer.openstack.org/health-monitor-timeout"
94
+ ServiceAnnotationLoadBalancerHealthMonitorMaxRetries = "loadbalancer.openstack.org/health-monitor-max-retries"
95
+ ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown = "loadbalancer.openstack.org/health-monitor-max-retries-down"
96
+ ServiceAnnotationLoadBalancerLoadbalancerHostname = "loadbalancer.openstack.org/hostname"
97
+ ServiceAnnotationLoadBalancerAddress = "loadbalancer.openstack.org/load-balancer-address"
97
98
// revive:disable:var-naming
98
99
ServiceAnnotationTlsContainerRef = "loadbalancer.openstack.org/default-tls-container-ref"
99
100
// revive:enable:var-naming
@@ -325,33 +326,34 @@ func tagList(tags string) ([]string, bool, bool) {
325
326
326
327
// serviceConfig contains configurations for creating a Service.
327
328
type serviceConfig struct {
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
- preferredIPFamily corev1.IPFamily // preferred (the first) IP family indicated in service's `spec.ipFamilies`
329
+ internal bool
330
+ connLimit int
331
+ configClassName string
332
+ lbNetworkID string
333
+ lbSubnetID string
334
+ lbMemberSubnetID string
335
+ lbPublicNetworkID string
336
+ lbPublicSubnetSpec * floatingSubnetSpec
337
+ keepClientIP bool
338
+ enableProxyProtocol bool
339
+ timeoutClientData int
340
+ timeoutMemberConnect int
341
+ timeoutMemberData int
342
+ timeoutTCPInspect int
343
+ allowedCIDR []string
344
+ enableMonitor bool
345
+ flavorID string
346
+ availabilityZone string
347
+ tlsContainerRef string
348
+ lbID string
349
+ lbName string
350
+ supportLBTags bool
351
+ healthCheckNodePort int
352
+ healthMonitorDelay int
353
+ healthMonitorTimeout int
354
+ healthMonitorMaxRetries int
355
+ healthMonitorMaxRetriesDown int
356
+ preferredIPFamily corev1.IPFamily // preferred (the first) IP family indicated in service's `spec.ipFamilies`
355
357
}
356
358
357
359
type listenerKey struct {
@@ -1091,11 +1093,15 @@ func (lbaas *LbaasV2) ensureOctaviaHealthMonitor(lbID string, name string, pool
1091
1093
}
1092
1094
monitorID = ""
1093
1095
}
1094
- if svcConf .healthMonitorDelay != monitor .Delay || svcConf .healthMonitorTimeout != monitor .Timeout || svcConf .healthMonitorMaxRetries != monitor .MaxRetries {
1096
+ if svcConf .healthMonitorDelay != monitor .Delay ||
1097
+ svcConf .healthMonitorTimeout != monitor .Timeout ||
1098
+ svcConf .healthMonitorMaxRetries != monitor .MaxRetries ||
1099
+ svcConf .healthMonitorMaxRetriesDown != monitor .MaxRetriesDown {
1095
1100
updateOpts := v2monitors.UpdateOpts {
1096
- Delay : svcConf .healthMonitorDelay ,
1097
- Timeout : svcConf .healthMonitorTimeout ,
1098
- MaxRetries : svcConf .healthMonitorMaxRetries ,
1101
+ Delay : svcConf .healthMonitorDelay ,
1102
+ Timeout : svcConf .healthMonitorTimeout ,
1103
+ MaxRetries : svcConf .healthMonitorMaxRetries ,
1104
+ MaxRetriesDown : svcConf .healthMonitorMaxRetriesDown ,
1099
1105
}
1100
1106
klog .Infof ("Updating health monitor %s updateOpts %+v" , monitorID , updateOpts )
1101
1107
if err := openstackutil .UpdateHealthMonitor (lbaas .lb , monitorID , updateOpts ); err != nil {
@@ -1142,10 +1148,11 @@ func (lbaas *LbaasV2) canUseHTTPMonitor(port corev1.ServicePort) bool {
1142
1148
// buildMonitorCreateOpts returns a v2monitors.CreateOpts without PoolID for consumption of both, fully popuplated Loadbalancers and Monitors.
1143
1149
func (lbaas * LbaasV2 ) buildMonitorCreateOpts (svcConf * serviceConfig , port corev1.ServicePort ) v2monitors.CreateOpts {
1144
1150
opts := v2monitors.CreateOpts {
1145
- Type : string (port .Protocol ),
1146
- Delay : svcConf .healthMonitorDelay ,
1147
- Timeout : svcConf .healthMonitorTimeout ,
1148
- MaxRetries : svcConf .healthMonitorMaxRetries ,
1151
+ Type : string (port .Protocol ),
1152
+ Delay : svcConf .healthMonitorDelay ,
1153
+ Timeout : svcConf .healthMonitorTimeout ,
1154
+ MaxRetries : svcConf .healthMonitorMaxRetries ,
1155
+ MaxRetriesDown : svcConf .healthMonitorMaxRetriesDown ,
1149
1156
}
1150
1157
if port .Protocol == corev1 .ProtocolUDP {
1151
1158
opts .Type = "UDP-CONNECT"
@@ -1580,6 +1587,7 @@ func (lbaas *LbaasV2) checkServiceUpdate(service *corev1.Service, nodes []*corev
1580
1587
svcConf .healthMonitorDelay = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorDelay , int (lbaas .opts .MonitorDelay .Duration .Seconds ()))
1581
1588
svcConf .healthMonitorTimeout = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorTimeout , int (lbaas .opts .MonitorTimeout .Duration .Seconds ()))
1582
1589
svcConf .healthMonitorMaxRetries = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetries , int (lbaas .opts .MonitorMaxRetries ))
1590
+ svcConf .healthMonitorMaxRetriesDown = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown , int (lbaas .opts .MonitorMaxRetriesDown ))
1583
1591
return nil
1584
1592
}
1585
1593
@@ -1815,6 +1823,7 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node
1815
1823
svcConf .healthMonitorDelay = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorDelay , int (lbaas .opts .MonitorDelay .Duration .Seconds ()))
1816
1824
svcConf .healthMonitorTimeout = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorTimeout , int (lbaas .opts .MonitorTimeout .Duration .Seconds ()))
1817
1825
svcConf .healthMonitorMaxRetries = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetries , int (lbaas .opts .MonitorMaxRetries ))
1826
+ svcConf .healthMonitorMaxRetriesDown = getIntFromServiceAnnotation (service , ServiceAnnotationLoadBalancerHealthMonitorMaxRetriesDown , int (lbaas .opts .MonitorMaxRetriesDown ))
1818
1827
return nil
1819
1828
}
1820
1829
0 commit comments