clean up winkernel proxy

This commit is contained in:
m1093782566 2017-10-11 16:30:24 +08:00
parent 6e2249b784
commit 8b8c305de4

View File

@ -1,7 +1,7 @@
// +build windows
/*
Copyright 2015 The Kubernetes Authors.
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -925,8 +925,7 @@ func serviceToServiceMap(service *api.Service) proxyServiceMap {
return serviceMap
}
// This is where all of the hns -save/restore calls happen.
// The only other hns rules are those that are setup in iptablesInit()
// This is where all of the hns save/restore calls happen.
// assumes proxier.mu is held
func (proxier *Proxier) syncProxyRules() {
proxier.mu.Lock()
@ -970,7 +969,7 @@ func (proxier *Proxier) syncProxyRules() {
var hnsEndpoints []hcsshim.HNSEndpoint
glog.V(4).Infof("====Applying Policy for %s====", svcName)
// Create Remote endpoints for every endpoint, corresponding to the service
if len(proxier.endpointsMap[svcName]) > 0 {
for _, ep := range proxier.endpointsMap[svcName] {
var newHnsEndpoint *hcsshim.HNSEndpoint
hnsNetworkName := proxier.network.name
@ -988,7 +987,7 @@ func (proxier *Proxier) syncProxyRules() {
if newHnsEndpoint == nil {
if ep.isLocal {
glog.Errorf("Local endpoint not found for %v: err : %v on network %s", ep.ip, err, hnsNetworkName)
glog.Errorf("Local endpoint not found for %v: err: %v on network %s", ep.ip, err, hnsNetworkName)
continue
}
// hns Endpoint resource was not found, create one
@ -1017,7 +1016,6 @@ func (proxier *Proxier) syncProxyRules() {
ep.refCount++
Log(ep, "Endpoint resource found", 3)
}
}
glog.V(3).Infof("Associated endpoints [%s] for service [%s]", spew.Sdump(hnsEndpoints), svcName)
@ -1050,7 +1048,7 @@ func (proxier *Proxier) syncProxyRules() {
svcInfo.hnsID = hnsLoadBalancer.ID
glog.V(3).Infof("Hns LoadBalancer resource created for cluster ip resources %v, Id [%s]", svcInfo.clusterIP, hnsLoadBalancer.ID)
// If nodePort is speficied, user should be able to use nodeIP:nodePort to reach the backend endpoints
// If nodePort is specified, user should be able to use nodeIP:nodePort to reach the backend endpoints
if svcInfo.nodePort > 0 {
hnsLoadBalancer, err := getHnsLoadBalancer(
hnsEndpoints,