@@ -680,21 +680,22 @@ func healthCheckPortInUse(serviceLister listersv1.ServiceLister, port int32) (bo
680
680
return false , err
681
681
}
682
682
for _ , service := range serviceList {
683
- if service .DeletionTimestamp == nil || service .Spec .Type == api .ServiceTypeLoadBalancer {
684
- if service .Spec .ExternalTrafficPolicy == api .ServiceExternalTrafficPolicyCluster {
685
- // This service is using the default healthcheck port, so we must check if
686
- // any other service is also using this default healthcheck port.
687
- if port == lbNodesHealthCheckPort {
688
- return true , nil
689
- }
690
- } else if service .Spec .ExternalTrafficPolicy == api .ServiceExternalTrafficPolicyLocal {
691
- // This service is using a custom healthcheck port (enabled through setting
692
- // externalTrafficPolicy=Local on the service). As this port is unique
693
- // per service, we know no other service will be using this port too.
694
- if port == service .Spec .HealthCheckNodePort {
695
- // Service with this healthCheckerPort is still not deleted (this would be a "delete listener" call in that case)
696
- return true , nil
697
- }
683
+ if service .DeletionTimestamp != nil || service .Spec .Type != api .ServiceTypeLoadBalancer {
684
+ continue
685
+ }
686
+ if service .Spec .ExternalTrafficPolicy == api .ServiceExternalTrafficPolicyCluster {
687
+ // This service is using the default healthcheck port, so we must check if
688
+ // any other service is also using this default healthcheck port.
689
+ if port == lbNodesHealthCheckPort {
690
+ return true , nil
691
+ }
692
+ } else if service .Spec .ExternalTrafficPolicy == api .ServiceExternalTrafficPolicyLocal {
693
+ // This service is using a custom healthcheck port (enabled through setting
694
+ // externalTrafficPolicy=Local on the service). As this port is unique
695
+ // per service, we know no other service will be using this port too.
696
+ if port == service .Spec .HealthCheckNodePort {
697
+ // Service with this healthCheckerPort is still not deleted (this would be a "delete listener" call in that case)
698
+ return true , nil
698
699
}
699
700
}
700
701
}
0 commit comments