From 378fcc809ab4fec0915b0dbfad49fe8c0202f5d7 Mon Sep 17 00:00:00 2001 From: ksubrmnn Date: Tue, 2 Jul 2019 14:16:23 -0700 Subject: [PATCH] Check for node IP --- pkg/proxy/winkernel/proxier.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/proxy/winkernel/proxier.go b/pkg/proxy/winkernel/proxier.go index ea435210da1..ef4575bec0c 100644 --- a/pkg/proxy/winkernel/proxier.go +++ b/pkg/proxy/winkernel/proxier.go @@ -1076,6 +1076,7 @@ func (proxier *Proxier) syncProxyRules() { klog.V(4).Infof("====Applying Policy for %s====", svcName) // Create Remote endpoints for every endpoint, corresponding to the service containsPublicIP := false + containsNodeIP := false for _, ep := range proxier.endpointsMap[svcName] { var newHnsEndpoint *endpointsInfo @@ -1126,13 +1127,15 @@ func (proxier *Proxier) syncProxyRules() { } if ep.ip == rs.providerAddress { providerAddress = rs.providerAddress + containsNodeIP = true } } if len(providerAddress) == 0 { - klog.Errorf("Could not find provider address for %s", ep.ip) + klog.Infof("Could not find provider address for %s. Assuming it is a public IP", ep.ip) providerAddress = proxier.nodeIP.String() containsPublicIP = true } + hnsEndpoint := &endpointsInfo{ ip: ep.ip, isLocal: false, @@ -1186,7 +1189,7 @@ func (proxier *Proxier) syncProxyRules() { klog.V(4).Infof("Trying to Apply Policies for service %s", spew.Sdump(svcInfo)) var hnsLoadBalancer *loadBalancerInfo var sourceVip = proxier.sourceVip - if containsPublicIP { + if containsPublicIP || containsNodeIP { sourceVip = proxier.nodeIP.String() } hnsLoadBalancer, err := hns.getLoadBalancer(