Merge pull request #41487 from anhowe/anhowe-windowsproxy

Automatic merge from submit-queue (batch tested with PRs 42200, 39535, 41708, 41487, 41335)

Update kube-proxy support for Windows

**What this PR does / why we need it**:

The kube-proxy is built upon the sophisticated iptables NAT rules.  Windows does not have an equivalent capability.  This introduces a change to the architecture of the user space mode of the Windows version of kube-proxy to match the capabilities of Windows.

The proxy is organized around service ports and portals.  For each service a service port is created and then a portal, or iptables NAT rule, is opened for each service ip, external ip, node port, and ingress ip.  This PR merges the service port and portal into a single concept of a "ServicePortPortal" where there is one connection opened for each of service IP, external ip, node port, and ingress IP.

This PR only affects the Windows kube-proxy.  It is important for the Windows kube-proxy because it removes the limited portproxy rule and RRAS service and enables full tcp/udp capability to services.

**Special notes for your reviewer**:

**Release note**:

```
Add tcp/udp userspace proxy support for Windows.
```
This commit is contained in:
Kubernetes Submit Queue
2017-02-28 20:16:10 -08:00
committed by GitHub
8 changed files with 374 additions and 848 deletions

View File

@@ -250,15 +250,15 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
userspace.CleanupLeftovers(iptInterface)
} else {
glog.V(0).Info("Using userspace Proxier.")
// This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for
// our config.EndpointsConfigHandler.
loadBalancer := userspace.NewLoadBalancerRR()
// set EndpointsConfigHandler to our loadBalancer
endpointsHandler = loadBalancer
var proxierUserspace proxy.ProxyProvider
if runtime.GOOS == "windows" {
// This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for
// our config.EndpointsConfigHandler.
loadBalancer := winuserspace.NewLoadBalancerRR()
// set EndpointsConfigHandler to our loadBalancer
endpointsHandler = loadBalancer
proxierUserspace, err = winuserspace.NewProxier(
loadBalancer,
net.ParseIP(config.BindAddress),
@@ -269,6 +269,11 @@ func NewProxyServerDefault(config *options.ProxyServerConfig) (*ProxyServer, err
config.UDPIdleTimeout.Duration,
)
} else {
// This is a proxy.LoadBalancer which NewProxier needs but has methods we don't need for
// our config.EndpointsConfigHandler.
loadBalancer := userspace.NewLoadBalancerRR()
// set EndpointsConfigHandler to our loadBalancer
endpointsHandler = loadBalancer
proxierUserspace, err = userspace.NewProxier(
loadBalancer,
net.ParseIP(config.BindAddress),