mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +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 {
|
if port.Port == *servicePort {
|
||||||
foundPort = true
|
foundPort = true
|
||||||
portName = port.Name
|
portName = port.Name
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !foundPort {
|
if !foundPort {
|
||||||
@ -238,6 +239,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
hasActiveEndpoints := false
|
hasActiveEndpoints := false
|
||||||
|
outer:
|
||||||
for _, subset := range endpoints.Subsets {
|
for _, subset := range endpoints.Subsets {
|
||||||
if len(subset.Addresses) == 0 {
|
if len(subset.Addresses) == 0 {
|
||||||
continue
|
continue
|
||||||
@ -245,6 +247,7 @@ func (c *AvailableConditionController) sync(key string) error {
|
|||||||
for _, endpointPort := range subset.Ports {
|
for _, endpointPort := range subset.Ports {
|
||||||
if endpointPort.Name == portName {
|
if endpointPort.Name == portName {
|
||||||
hasActiveEndpoints = true
|
hasActiveEndpoints = true
|
||||||
|
break outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user