Reorganize a bit of winkernel proxier setup
Rather than doing winkernel-specific parsing of generic config data in cmd/kube-proxy, do it in pkg/proxy/winkernel.
This commit is contained in:
		| @@ -25,7 +25,6 @@ import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"net" | ||||
| 	"strconv" | ||||
|  | ||||
| 	// Enable pprof HTTP handlers. | ||||
| 	_ "net/http/pprof" | ||||
| @@ -83,11 +82,6 @@ func (s *ProxyServer) createProxier(config *proxyconfigapi.KubeProxyConfiguratio | ||||
| 	if initOnly { | ||||
| 		return nil, fmt.Errorf("--init-only is not implemented on Windows") | ||||
| 	} | ||||
| 	var healthzPort int | ||||
| 	if len(config.HealthzBindAddress) > 0 { | ||||
| 		_, port, _ := net.SplitHostPort(config.HealthzBindAddress) | ||||
| 		healthzPort, _ = strconv.Atoi(port) | ||||
| 	} | ||||
|  | ||||
| 	var proxier proxy.Provider | ||||
| 	var err error | ||||
| @@ -100,8 +94,8 @@ func (s *ProxyServer) createProxier(config *proxyconfigapi.KubeProxyConfiguratio | ||||
| 			s.NodeIPs, | ||||
| 			s.Recorder, | ||||
| 			s.HealthzServer, | ||||
| 			config.HealthzBindAddress, | ||||
| 			config.Winkernel, | ||||
| 			healthzPort, | ||||
| 		) | ||||
| 	} else { | ||||
| 		proxier, err = winkernel.NewProxier( | ||||
| @@ -112,8 +106,8 @@ func (s *ProxyServer) createProxier(config *proxyconfigapi.KubeProxyConfiguratio | ||||
| 			s.NodeIPs[s.PrimaryIPFamily], | ||||
| 			s.Recorder, | ||||
| 			s.HealthzServer, | ||||
| 			config.HealthzBindAddress, | ||||
| 			config.Winkernel, | ||||
| 			healthzPort, | ||||
| 		) | ||||
| 	} | ||||
| 	if err != nil { | ||||
|   | ||||
| @@ -657,8 +657,8 @@ func NewProxier( | ||||
| 	nodeIP net.IP, | ||||
| 	recorder events.EventRecorder, | ||||
| 	healthzServer *healthcheck.ProxierHealthServer, | ||||
| 	healthzBindAddress string, | ||||
| 	config config.KubeProxyWinkernelConfiguration, | ||||
| 	healthzPort int, | ||||
| ) (*Proxier, error) { | ||||
| 	if nodeIP == nil { | ||||
| 		klog.InfoS("Invalid nodeIP, initializing kube-proxy with 127.0.0.1 as nodeIP") | ||||
| @@ -669,6 +669,12 @@ func NewProxier( | ||||
| 	nodePortAddresses := proxyutil.NewNodePortAddresses(ipFamily, nil) | ||||
| 	serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder, nodePortAddresses, healthzServer) | ||||
|  | ||||
| 	var healthzPort int | ||||
| 	if len(healthzBindAddress) > 0 { | ||||
| 		_, port, _ := net.SplitHostPort(healthzBindAddress) | ||||
| 		healthzPort, _ = strconv.Atoi(port) | ||||
| 	} | ||||
|  | ||||
| 	hcnImpl := newHcnImpl() | ||||
| 	hns, supportedFeatures := newHostNetworkService(hcnImpl) | ||||
| 	hnsNetworkName, err := getNetworkName(config.NetworkName) | ||||
| @@ -787,14 +793,14 @@ func NewDualStackProxier( | ||||
| 	nodeIPs map[v1.IPFamily]net.IP, | ||||
| 	recorder events.EventRecorder, | ||||
| 	healthzServer *healthcheck.ProxierHealthServer, | ||||
| 	healthzBindAddress string, | ||||
| 	config config.KubeProxyWinkernelConfiguration, | ||||
| 	healthzPort int, | ||||
| ) (proxy.Provider, error) { | ||||
|  | ||||
| 	// Create an ipv4 instance of the single-stack proxier | ||||
| 	ipv4Proxier, err := NewProxier(v1.IPv4Protocol, syncPeriod, minSyncPeriod, | ||||
| 		hostname, nodeIPs[v1.IPv4Protocol], recorder, healthzServer, | ||||
| 		config, healthzPort) | ||||
| 		healthzBindAddress, config) | ||||
|  | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("unable to create ipv4 proxier: %v, hostname: %s, nodeIP:%v", err, hostname, nodeIPs[v1.IPv4Protocol]) | ||||
| @@ -802,7 +808,7 @@ func NewDualStackProxier( | ||||
|  | ||||
| 	ipv6Proxier, err := NewProxier(v1.IPv6Protocol, syncPeriod, minSyncPeriod, | ||||
| 		hostname, nodeIPs[v1.IPv6Protocol], recorder, healthzServer, | ||||
| 		config, healthzPort) | ||||
| 		healthzBindAddress, config) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("unable to create ipv6 proxier: %v, hostname: %s, nodeIP:%v", err, hostname, nodeIPs[v1.IPv6Protocol]) | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dan Winship
					Dan Winship