mirror of https://github.com/k3s-io/k3s
fix winspace wrong comment message
parent
02b520f0a4
commit
d56344fdf7
|
@ -122,22 +122,14 @@ var (
|
||||||
ErrProxyOnLocalhost = fmt.Errorf("cannot proxy on localhost")
|
ErrProxyOnLocalhost = fmt.Errorf("cannot proxy on localhost")
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsProxyLocked returns true if the proxy could not acquire the lock on iptables.
|
|
||||||
func IsProxyLocked(err error) bool {
|
|
||||||
return strings.Contains(err.Error(), "holding the xtables lock")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used below.
|
// Used below.
|
||||||
var localhostIPv4 = net.ParseIP("127.0.0.1")
|
var localhostIPv4 = net.ParseIP("127.0.0.1")
|
||||||
var localhostIPv6 = net.ParseIP("::1")
|
var localhostIPv6 = net.ParseIP("::1")
|
||||||
|
|
||||||
// NewProxier returns a new Proxier given a LoadBalancer and an address on
|
// NewProxier returns a new Proxier given a LoadBalancer and an address on
|
||||||
// which to listen. Because of the iptables logic, It is assumed that there
|
// which to listen. It is assumed that there is only a single Proxier active
|
||||||
// is only a single Proxier active on a machine. An error will be returned if
|
// on a machine. An error will be returned if the proxier cannot be started
|
||||||
// the proxier cannot be started due to an invalid ListenIP (loopback) or
|
// due to an invalid ListenIP (loopback)
|
||||||
// if iptables fails to update or acquire the initial lock. Once a proxier is
|
|
||||||
// created, it will keep iptables up to date in the background and will not
|
|
||||||
// terminate if a particular iptables call fails.
|
|
||||||
func NewProxier(loadBalancer LoadBalancer, listenIP net.IP, netsh netsh.Interface, pr utilnet.PortRange, syncPeriod, udpIdleTimeout time.Duration) (*Proxier, error) {
|
func NewProxier(loadBalancer LoadBalancer, listenIP net.IP, netsh netsh.Interface, pr utilnet.PortRange, syncPeriod, udpIdleTimeout time.Duration) (*Proxier, error) {
|
||||||
if listenIP.Equal(localhostIPv4) || listenIP.Equal(localhostIPv6) {
|
if listenIP.Equal(localhostIPv4) || listenIP.Equal(localhostIPv6) {
|
||||||
return nil, ErrProxyOnLocalhost
|
return nil, ErrProxyOnLocalhost
|
||||||
|
@ -148,7 +140,7 @@ func NewProxier(loadBalancer LoadBalancer, listenIP net.IP, netsh netsh.Interfac
|
||||||
return nil, fmt.Errorf("failed to select a host interface: %v", err)
|
return nil, fmt.Errorf("failed to select a host interface: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.V(2).Infof("Setting proxy IP to %v and initializing iptables", hostIP)
|
glog.V(2).Infof("Setting proxy IP to %v", hostIP)
|
||||||
return createProxier(loadBalancer, listenIP, netsh, hostIP, syncPeriod, udpIdleTimeout)
|
return createProxier(loadBalancer, listenIP, netsh, hostIP, syncPeriod, udpIdleTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue