Merge pull request #87792 from ksubrmnn/nodeip

Allow access to default Kubernetes Service from inside Windows Pod (Overlay)
This commit is contained in:
Kubernetes Prow Robot 2020-02-20 03:07:04 -08:00 committed by GitHub
commit 09d78529db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1091,6 +1091,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
@ -1141,13 +1142,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,
@ -1201,7 +1204,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(