Moved counting logic to accommodate rebase

This commit is contained in:
Max Renaud 2022-04-01 15:52:21 +00:00
parent 61b7e6c49c
commit 6454248b6b

View File

@ -1999,6 +1999,14 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
// Traffic from an external source will be routed but the reply
// will have the POD address and will be discarded.
endpoints = clusterEndpoints
if svcInfo.InternalPolicyLocal() && utilfeature.DefaultFeatureGate.Enabled(features.ServiceInternalTrafficPolicy) {
proxier.serviceNoLocalEndpointsInternal.Insert(svcPortName.NamespacedName.String())
}
if svcInfo.ExternalPolicyLocal() {
proxier.serviceNoLocalEndpointsExternal.Insert(svcPortName.NamespacedName.String())
}
}
} else {
endpoints = clusterEndpoints
@ -2009,15 +2017,6 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
for _, epInfo := range endpoints {
newEndpoints.Insert(epInfo.String())
}
if onlyNodeLocalEndpoints && len(newEndpoints) == 0 {
if svcInfo.InternalPolicyLocal() && utilfeature.DefaultFeatureGate.Enabled(features.ServiceInternalTrafficPolicy) {
proxier.serviceNoLocalEndpointsInternal.Insert(svcPortName.NamespacedName.String())
}
if svcInfo.ExternalPolicyLocal() {
proxier.serviceNoLocalEndpointsExternal.Insert(svcPortName.NamespacedName.String())
}
}
// Create new endpoints
for _, ep := range newEndpoints.List() {