mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Don't increment "no local endpoints" metric when there are no remote endpoints
A service having no _local_ endpoints when it does have remote endpoints is different from a service having no endpoints at all.
This commit is contained in:
@@ -1354,24 +1354,19 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
if len(localEndpoints) != 0 {
|
||||
// Write rules jumping from localPolicyChain to localEndpointChains
|
||||
proxier.writeServiceToEndpointRules(svcNameString, svcInfo, localPolicyChain, localEndpoints, args)
|
||||
} else {
|
||||
} else if hasEndpoints {
|
||||
if svcInfo.InternalPolicyLocal() && utilfeature.DefaultFeatureGate.Enabled(features.ServiceInternalTrafficPolicy) {
|
||||
serviceNoLocalEndpointsTotalInternal++
|
||||
}
|
||||
if svcInfo.ExternalPolicyLocal() {
|
||||
serviceNoLocalEndpointsTotalExternal++
|
||||
}
|
||||
if hasEndpoints {
|
||||
// Blackhole all traffic since there are no local endpoints
|
||||
args = append(args[:0],
|
||||
"-A", string(localPolicyChain),
|
||||
"-m", "comment", "--comment",
|
||||
fmt.Sprintf(`"%s has no local endpoints"`, svcNameString),
|
||||
"-j",
|
||||
string(KubeMarkDropChain),
|
||||
)
|
||||
proxier.natRules.Write(args)
|
||||
}
|
||||
// Blackhole all traffic since there are no local endpoints
|
||||
proxier.natRules.Write(
|
||||
"-A", string(localPolicyChain),
|
||||
"-m", "comment", "--comment",
|
||||
fmt.Sprintf(`"%s has no local endpoints"`, svcNameString),
|
||||
"-j", string(KubeMarkDropChain))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user