mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #82095 from tedyu/avail-ctrol
Break out of the loop when active endpoint is found
This commit is contained in:
commit
9648b475c6
@ -210,6 +210,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
||||
if port.Port == *servicePort {
|
||||
foundPort = true
|
||||
portName = port.Name
|
||||
break
|
||||
}
|
||||
}
|
||||
if !foundPort {
|
||||
@ -238,6 +239,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
||||
return err
|
||||
}
|
||||
hasActiveEndpoints := false
|
||||
outer:
|
||||
for _, subset := range endpoints.Subsets {
|
||||
if len(subset.Addresses) == 0 {
|
||||
continue
|
||||
@ -245,6 +247,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
||||
for _, endpointPort := range subset.Ports {
|
||||
if endpointPort.Name == portName {
|
||||
hasActiveEndpoints = true
|
||||
break outer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user