Merge pull request #82095 from tedyu/avail-ctrol

Break out of the loop when active endpoint is found
This commit is contained in:
Kubernetes Prow Robot 2019-09-11 18:27:15 -07:00 committed by GitHub
commit 9648b475c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}
}