From 6c68ca5a9e7688069d0b7f186f024544e0a0c171 Mon Sep 17 00:00:00 2001 From: Sravanth Bangari Date: Wed, 11 Nov 2020 23:29:07 -0800 Subject: [PATCH] Choosing the right source VIP for local endpoints --- pkg/proxy/winkernel/proxier.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/proxy/winkernel/proxier.go b/pkg/proxy/winkernel/proxier.go index 80eee1b5187..47b449e3714 100644 --- a/pkg/proxy/winkernel/proxier.go +++ b/pkg/proxy/winkernel/proxier.go @@ -1088,7 +1088,18 @@ func (proxier *Proxier) syncProxyRules() { } } - if proxier.network.networkType == "Overlay" { + // For Overlay networks 'SourceVIP' on an Load balancer Policy can either be chosen as + // a) Source VIP configured on kube-proxy (or) + // b) Node IP of the current node + // + // For L2Bridge network the Source VIP is always the NodeIP of the current node and the same + // would be configured on kube-proxy as SourceVIP + // + // The logic for choosing the SourceVIP in Overlay networks is based on the backend endpoints: + // a) Endpoints are any IP's outside the cluster ==> Choose NodeIP as the SourceVIP + // b) Endpoints are IP addresses of a remote node => Choose NodeIP as the SourceVIP + // c) Everything else (Local POD's, Remote POD's, Node IP of current node) ==> Choose the configured SourceVIP + if proxier.network.networkType == "Overlay" && !ep.GetIsLocal() { providerAddress := proxier.network.findRemoteSubnetProviderAddress(ep.IP()) isNodeIP := (ep.IP() == providerAddress)