Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f78c4dacc5 | ||
|
|
9245b73913 | ||
|
|
6ee961b068 | ||
|
|
1f920513de | ||
|
|
15f21f1899 | ||
|
|
09a204b978 | ||
|
|
77fbb2c12b | ||
|
|
6ad3e69faf | ||
|
|
e2088ef401 | ||
|
|
0f3864968e | ||
|
|
2f235daa1c | ||
|
|
438a5f5fd1 | ||
|
|
b051ef0878 | ||
|
|
48015aa7be | ||
|
|
4e3acfdc02 | ||
|
|
11915948a2 |
No files matched your search
@@ -1,3 +1,12 @@
|
|||||||
|
## Release 2.6.3
|
||||||
|
|
||||||
|
This release has a couple of security improvements, and some other fixes.
|
||||||
|
|
||||||
|
* Block non-local traffic to the Weave control port #3805
|
||||||
|
* Tell Linux not to accept router advisory messages #3801
|
||||||
|
* Network Policy Controller: add a metric to show errors while operating #3804
|
||||||
|
* Network Policy Controller: don't treat named port as a fatal error #3790
|
||||||
|
|
||||||
## Release 2.6.2
|
## Release 2.6.2
|
||||||
|
|
||||||
This release fixes a regression found in 2.6.1 release and removes a possible case
|
This release fixes a regression found in 2.6.1 release and removes a possible case
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ func SetLogLevel(levelname string) {
|
|||||||
Log.Level = level
|
Log.Level = level
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CheckError(e error) {
|
||||||
|
if e != nil {
|
||||||
|
Log.Error(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CheckFatal(e error) {
|
func CheckFatal(e error) {
|
||||||
if e != nil {
|
if e != nil {
|
||||||
Log.Fatal(e)
|
Log.Fatal(e)
|
||||||
|
|||||||
+20
-11
@@ -63,10 +63,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Bridge interface {
|
type Bridge interface {
|
||||||
init(config *BridgeConfig) error // create and initialise bridge device(s)
|
init(procPath string, config *BridgeConfig) error // create and initialise bridge device(s)
|
||||||
attach(veth *netlink.Veth) error // attach veth to bridge
|
attach(veth *netlink.Veth) error // attach veth to bridge
|
||||||
IsFastdp() bool // does this bridge use fastdp?
|
IsFastdp() bool // does this bridge use fastdp?
|
||||||
String() string // human-readable type string
|
String() string // human-readable type string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to indicate a fallback to the Bridge type
|
// Used to indicate a fallback to the Bridge type
|
||||||
@@ -250,7 +250,7 @@ func EnsureBridge(procPath string, config *BridgeConfig, log *logrus.Logger, ips
|
|||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if err := bridgeType.init(config); err != nil {
|
if err := bridgeType.init(procPath, config); err != nil {
|
||||||
if errors.Cause(err) == errBridgeNotSupported {
|
if errors.Cause(err) == errBridgeNotSupported {
|
||||||
log.Warnf("Skipping bridge creation of %q due to: %s", bridgeType, err)
|
log.Warnf("Skipping bridge creation of %q due to: %s", bridgeType, err)
|
||||||
bridgeType = bridgeImpl{}
|
bridgeType = bridgeImpl{}
|
||||||
@@ -279,6 +279,10 @@ func EnsureBridge(procPath string, config *BridgeConfig, log *logrus.Logger, ips
|
|||||||
return bridgeType, errors.Wrap(err, "setting proxy_arp")
|
return bridgeType, errors.Wrap(err, "setting proxy_arp")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// No ipv6 router advertisments please
|
||||||
|
if err := sysctl(procPath, "net/ipv6/conf/"+config.WeaveBridgeName+"/accept_ra", "0"); err != nil {
|
||||||
|
return bridgeType, errors.Wrap(err, "setting accept_ra to 0")
|
||||||
|
}
|
||||||
|
|
||||||
if err := linkSetUpByName(config.WeaveBridgeName); err != nil {
|
if err := linkSetUpByName(config.WeaveBridgeName); err != nil {
|
||||||
return bridgeType, err
|
return bridgeType, err
|
||||||
@@ -345,11 +349,11 @@ func (b bridgeImpl) initPrep(config *BridgeConfig) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b bridgeImpl) init(config *BridgeConfig) error {
|
func (b bridgeImpl) init(procPath string, config *BridgeConfig) error {
|
||||||
if err := b.initPrep(config); err != nil {
|
if err := b.initPrep(config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := CreateAndAttachVeth(BridgeIfName, PcapIfName, config.WeaveBridgeName, config.MTU, true, false, func(veth netlink.Link) error {
|
if _, err := CreateAndAttachVeth(procPath, BridgeIfName, PcapIfName, config.WeaveBridgeName, config.MTU, true, false, func(veth netlink.Link) error {
|
||||||
return netlink.LinkSetUp(veth)
|
return netlink.LinkSetUp(veth)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return errors.Wrap(err, "creating pcap veth pair")
|
return errors.Wrap(err, "creating pcap veth pair")
|
||||||
@@ -361,7 +365,7 @@ func (b bridgeImpl) init(config *BridgeConfig) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f fastdpImpl) init(config *BridgeConfig) error {
|
func (f fastdpImpl) init(procPath string, config *BridgeConfig) error {
|
||||||
odpSupported, err := odp.CreateDatapath(f.datapathName)
|
odpSupported, err := odp.CreateDatapath(f.datapathName)
|
||||||
if !odpSupported {
|
if !odpSupported {
|
||||||
msg := ""
|
msg := ""
|
||||||
@@ -392,14 +396,14 @@ func (f fastdpImpl) init(config *BridgeConfig) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bf bridgedFastdpImpl) init(config *BridgeConfig) error {
|
func (bf bridgedFastdpImpl) init(procPath string, config *BridgeConfig) error {
|
||||||
if err := bf.fastdpImpl.init(config); err != nil {
|
if err := bf.fastdpImpl.init(procPath, config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := bf.bridgeImpl.initPrep(config); err != nil {
|
if err := bf.bridgeImpl.initPrep(config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := CreateAndAttachVeth(BridgeIfName, DatapathIfName, config.WeaveBridgeName, config.MTU, true, false, func(veth netlink.Link) error {
|
if _, err := CreateAndAttachVeth(procPath, BridgeIfName, DatapathIfName, config.WeaveBridgeName, config.MTU, true, false, func(veth netlink.Link) error {
|
||||||
if err := netlink.LinkSetUp(veth); err != nil {
|
if err := netlink.LinkSetUp(veth); err != nil {
|
||||||
return errors.Wrapf(err, "setting link up on %q", veth.Attrs().Name)
|
return errors.Wrapf(err, "setting link up on %q", veth.Attrs().Name)
|
||||||
}
|
}
|
||||||
@@ -465,6 +469,11 @@ func configureIPTables(config *BridgeConfig, ips ipset.Interface) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Block non-local traffic to the Weave control port
|
||||||
|
if err = ipt.AppendUnique("filter", "INPUT", "-p", "tcp", "--dst", "127.0.0.1", "-m", "addrtype", "!", "--src-type", "LOCAL", "-m", "conntrack", "!", "--ctstate", "RELATED,ESTABLISHED", "-j", "DROP"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if config.NPC {
|
if config.NPC {
|
||||||
// Steer traffic via the NPC.
|
// Steer traffic via the NPC.
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -55,9 +55,9 @@ func WithNetNSByPath(path string, work func() error) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NSPathByPid(pid int) string {
|
func NSPathByPid(pid int) string {
|
||||||
return NSPathByPidWithRoot("/", pid)
|
return NSPathByPidWithProc("/proc", pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NSPathByPidWithRoot(root string, pid int) string {
|
func NSPathByPidWithProc(procPath string, pid int) string {
|
||||||
return filepath.Join(root, fmt.Sprintf("/proc/%d/ns/net", pid))
|
return filepath.Join(procPath, fmt.Sprint(pid), "/ns/net")
|
||||||
}
|
}
|
||||||
+17
-8
@@ -13,7 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// create and attach a veth to the Weave bridge
|
// create and attach a veth to the Weave bridge
|
||||||
func CreateAndAttachVeth(name, peerName, bridgeName string, mtu int, keepTXOn bool, errIfLinkExist bool, init func(peer netlink.Link) error) (*netlink.Veth, error) {
|
func CreateAndAttachVeth(procPath, name, peerName, bridgeName string, mtu int, keepTXOn bool, errIfLinkExist bool, init func(peer netlink.Link) error) (*netlink.Veth, error) {
|
||||||
bridge, err := netlink.LinkByName(bridgeName)
|
bridge, err := netlink.LinkByName(bridgeName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(`bridge "%s" not present; did you launch weave?`, bridgeName)
|
return nil, fmt.Errorf(`bridge "%s" not present; did you launch weave?`, bridgeName)
|
||||||
@@ -49,6 +49,13 @@ func CreateAndAttachVeth(name, peerName, bridgeName string, mtu int, keepTXOn bo
|
|||||||
if err := bridgeType.attach(veth); err != nil {
|
if err := bridgeType.attach(veth); err != nil {
|
||||||
return cleanup("attaching veth %q to %q: %s", name, bridgeName, err)
|
return cleanup("attaching veth %q to %q: %s", name, bridgeName, err)
|
||||||
}
|
}
|
||||||
|
// No ipv6 router advertisments please
|
||||||
|
if err := sysctl(procPath, "net/ipv6/conf/"+name+"/accept_ra", "0"); err != nil {
|
||||||
|
return cleanup("setting accept_ra to 0: %s", err)
|
||||||
|
}
|
||||||
|
if err := sysctl(procPath, "net/ipv6/conf/"+peerName+"/accept_ra", "0"); err != nil {
|
||||||
|
return cleanup("setting accept_ra to 0: %s", err)
|
||||||
|
}
|
||||||
if !bridgeType.IsFastdp() && !keepTXOn {
|
if !bridgeType.IsFastdp() && !keepTXOn {
|
||||||
if err := EthtoolTXOff(veth.PeerName); err != nil {
|
if err := EthtoolTXOff(veth.PeerName); err != nil {
|
||||||
return cleanup(`unable to set tx off on %q: %s`, peerName, err)
|
return cleanup(`unable to set tx off on %q: %s`, peerName, err)
|
||||||
@@ -112,6 +119,9 @@ func interfaceExistsInNamespace(netNSPath string, ifName string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool, hairpinMode bool) error {
|
func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool, hairpinMode bool) error {
|
||||||
|
// AttachContainer expects to be called in host pid namespace
|
||||||
|
const procPath = "/proc"
|
||||||
|
|
||||||
ns, err := netns.GetFromPath(netNSPath)
|
ns, err := netns.GetFromPath(netNSPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -124,12 +134,12 @@ func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMult
|
|||||||
id = id[:maxIDLen] // trim passed ID if too long
|
id = id[:maxIDLen] // trim passed ID if too long
|
||||||
}
|
}
|
||||||
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
|
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
|
||||||
veth, err := CreateAndAttachVeth(name, peerName, bridgeName, mtu, keepTXOn, true, func(veth netlink.Link) error {
|
veth, err := CreateAndAttachVeth(procPath, name, peerName, bridgeName, mtu, keepTXOn, true, func(veth netlink.Link) error {
|
||||||
if err := netlink.LinkSetNsFd(veth, int(ns)); err != nil {
|
if err := netlink.LinkSetNsFd(veth, int(ns)); err != nil {
|
||||||
return fmt.Errorf("failed to move veth to container netns: %s", err)
|
return fmt.Errorf("failed to move veth to container netns: %s", err)
|
||||||
}
|
}
|
||||||
if err := WithNetNS(ns, func() error {
|
if err := WithNetNS(ns, func() error {
|
||||||
return setupIface(peerName, ifName)
|
return setupIface(procPath, peerName, ifName)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("error setting up interface: %s", err)
|
return fmt.Errorf("error setting up interface: %s", err)
|
||||||
}
|
}
|
||||||
@@ -206,7 +216,7 @@ func setupIfaceAddrs(veth netlink.Link, withMulticastRoute bool, cidrs []*net.IP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setupIface expects to be called in the container's netns
|
// setupIface expects to be called in the container's netns
|
||||||
func setupIface(ifaceName, newIfName string) error {
|
func setupIface(procPath, ifaceName, newIfName string) error {
|
||||||
ipt, err := iptables.New()
|
ipt, err := iptables.New()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -219,15 +229,14 @@ func setupIface(ifaceName, newIfName string) error {
|
|||||||
if err := netlink.LinkSetName(link, newIfName); err != nil {
|
if err := netlink.LinkSetName(link, newIfName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// This is only called by AttachContainer which is only called in host pid namespace
|
if err := configureARPCache(procPath, newIfName); err != nil {
|
||||||
if err := configureARPCache("/proc", newIfName); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ipt.Append("filter", "INPUT", "-i", newIfName, "-d", "224.0.0.0/4", "-j", "DROP")
|
return ipt.Append("filter", "INPUT", "-i", newIfName, "-d", "224.0.0.0/4", "-j", "DROP")
|
||||||
}
|
}
|
||||||
|
|
||||||
// configureARP is a helper for the Docker plugin which doesn't set the addresses itself
|
// configureARP is a helper for the Docker plugin which doesn't set the addresses itself
|
||||||
func ConfigureARP(prefix, rootPath string) error {
|
func ConfigureARP(prefix, procPath string) error {
|
||||||
links, err := netlink.LinkList()
|
links, err := netlink.LinkList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -235,7 +244,7 @@ func ConfigureARP(prefix, rootPath string) error {
|
|||||||
for _, link := range links {
|
for _, link := range links {
|
||||||
ifName := link.Attrs().Name
|
ifName := link.Attrs().Name
|
||||||
if strings.HasPrefix(ifName, prefix) {
|
if strings.HasPrefix(ifName, prefix) {
|
||||||
configureARPCache(rootPath+"/proc", ifName)
|
configureARPCache(procPath, ifName)
|
||||||
if addrs, err := netlink.AddrList(link, netlink.FAMILY_V4); err == nil {
|
if addrs, err := netlink.AddrList(link, netlink.FAMILY_V4); err == nil {
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
arping.GratuitousArpOverIfaceByName(addr.IPNet.IP, ifName)
|
arping.GratuitousArpOverIfaceByName(addr.IPNet.IP, ifName)
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ var (
|
|||||||
},
|
},
|
||||||
[]string{"protocol", "dport"},
|
[]string{"protocol", "dport"},
|
||||||
)
|
)
|
||||||
|
PolicyEnforcementErrors = prometheus.NewCounter(
|
||||||
|
prometheus.CounterOpts{
|
||||||
|
Name: "weavenpc_policy_enforcement_errors",
|
||||||
|
Help: "Errors occured in enforcing the network policies.",
|
||||||
|
},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func gatherMetrics() {
|
func gatherMetrics() {
|
||||||
@@ -95,6 +101,9 @@ func Start(addr string) error {
|
|||||||
if err := prometheus.Register(blockedConnections); err != nil {
|
if err := prometheus.Register(blockedConnections); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := prometheus.Register(PolicyEnforcementErrors); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
http.Handle("/metrics", promhttp.Handler())
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,10 @@ type driver struct {
|
|||||||
// used only by plugin-v2
|
// used only by plugin-v2
|
||||||
forceMulticast bool
|
forceMulticast bool
|
||||||
networks map[string]network
|
networks map[string]network
|
||||||
|
procPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(client *docker.Client, weave *weaveapi.Client, name, scope string, dns, isPluginV2, forceMulticast bool) (skel.Driver, error) {
|
func New(client *docker.Client, weave *weaveapi.Client, name, scope string, dns, isPluginV2, forceMulticast bool, procPath string) (skel.Driver, error) {
|
||||||
driver := &driver{
|
driver := &driver{
|
||||||
name: name,
|
name: name,
|
||||||
scope: scope,
|
scope: scope,
|
||||||
@@ -51,6 +52,7 @@ func New(client *docker.Client, weave *weaveapi.Client, name, scope string, dns,
|
|||||||
// make sure that it's used only by plugin-v2
|
// make sure that it's used only by plugin-v2
|
||||||
forceMulticast: isPluginV2 && forceMulticast,
|
forceMulticast: isPluginV2 && forceMulticast,
|
||||||
networks: make(map[string]network),
|
networks: make(map[string]network),
|
||||||
|
procPath: procPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not start watcher in the case of plugin v2, which prevents us from
|
// Do not start watcher in the case of plugin v2, which prevents us from
|
||||||
@@ -134,7 +136,7 @@ func (driver *driver) CreateEndpoint(create *api.CreateEndpointRequest) (*api.Cr
|
|||||||
|
|
||||||
// create veths. note we assume endpoint IDs are unique in the first 9 chars
|
// create veths. note we assume endpoint IDs are unique in the first 9 chars
|
||||||
name, peerName := vethPair(create.EndpointID)
|
name, peerName := vethPair(create.EndpointID)
|
||||||
if _, err := weavenet.CreateAndAttachVeth(name, peerName, weavenet.WeaveBridgeName, 0, false, true, nil); err != nil {
|
if _, err := weavenet.CreateAndAttachVeth(driver.procPath, name, peerName, weavenet.WeaveBridgeName, 0, false, true, nil); err != nil {
|
||||||
return nil, driver.error("JoinEndpoint", "%s", err)
|
return nil, driver.error("JoinEndpoint", "%s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,14 +43,9 @@ func (w *watcher) ContainerStarted(id string) {
|
|||||||
w.driver.warn("ContainerStarted", "unable to register %s with weaveDNS: %s", id, err)
|
w.driver.warn("ContainerStarted", "unable to register %s with weaveDNS: %s", id, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootDir := "/"
|
netNSPath := weavenet.NSPathByPidWithProc(w.driver.procPath, info.State.Pid)
|
||||||
if w.driver.isPluginV2 {
|
|
||||||
// We bind mount host's /proc to /host/proc for plugin-v2
|
|
||||||
rootDir = "/host"
|
|
||||||
}
|
|
||||||
netNSPath := weavenet.NSPathByPidWithRoot(rootDir, info.State.Pid)
|
|
||||||
if err := weavenet.WithNetNSByPath(netNSPath, func() error {
|
if err := weavenet.WithNetNSByPath(netNSPath, func() error {
|
||||||
return weavenet.ConfigureARP(weavenet.VethName, rootDir)
|
return weavenet.ConfigureARP(weavenet.VethName, w.driver.procPath)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
w.driver.warn("ContainerStarted", "unable to configure interfaces: %s", err)
|
w.driver.warn("ContainerStarted", "unable to configure interfaces: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -32,6 +32,7 @@ type Config struct {
|
|||||||
EnableV2Multicast bool
|
EnableV2Multicast bool
|
||||||
DNS bool
|
DNS bool
|
||||||
DefaultSubnet string
|
DefaultSubnet string
|
||||||
|
ProcPath string // path to reach host /proc filesystem
|
||||||
}
|
}
|
||||||
|
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
@@ -62,7 +63,7 @@ func (plugin *Plugin) run(dockerClient *docker.Client, weave *weaveapi.Client, r
|
|||||||
endChan := make(chan error, 1)
|
endChan := make(chan error, 1)
|
||||||
|
|
||||||
if plugin.Socket != "" {
|
if plugin.Socket != "" {
|
||||||
globalListener, err := listenAndServe(dockerClient, weave, plugin.Socket, endChan, "global", false, plugin.DNS, plugin.EnableV2, plugin.EnableV2Multicast)
|
globalListener, err := listenAndServe(dockerClient, weave, plugin.Socket, endChan, "global", false, plugin.DNS, plugin.EnableV2, plugin.EnableV2Multicast, plugin.ProcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,7 @@ func (plugin *Plugin) run(dockerClient *docker.Client, weave *weaveapi.Client, r
|
|||||||
defer globalListener.Close()
|
defer globalListener.Close()
|
||||||
}
|
}
|
||||||
if plugin.MeshSocket != "" {
|
if plugin.MeshSocket != "" {
|
||||||
meshListener, err := listenAndServe(dockerClient, weave, plugin.MeshSocket, endChan, "local", true, plugin.DNS, plugin.EnableV2, plugin.EnableV2Multicast)
|
meshListener, err := listenAndServe(dockerClient, weave, plugin.MeshSocket, endChan, "local", true, plugin.DNS, plugin.EnableV2, plugin.EnableV2Multicast, plugin.ProcPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -87,7 +88,7 @@ func (plugin *Plugin) run(dockerClient *docker.Client, weave *weaveapi.Client, r
|
|||||||
return <-endChan
|
return <-endChan
|
||||||
}
|
}
|
||||||
|
|
||||||
func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address string, endChan chan<- error, scope string, withIpam, dns bool, isPluginV2, forceMulticast bool) (net.Listener, error) {
|
func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address string, endChan chan<- error, scope string, withIpam, dns bool, isPluginV2, forceMulticast bool, procPath string) (net.Listener, error) {
|
||||||
var name string
|
var name string
|
||||||
if isPluginV2 {
|
if isPluginV2 {
|
||||||
name = pluginV2Name
|
name = pluginV2Name
|
||||||
@@ -95,7 +96,7 @@ func listenAndServe(dockerClient *docker.Client, weave *weaveapi.Client, address
|
|||||||
name = pluginNameFromAddress(address)
|
name = pluginNameFromAddress(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := netplugin.New(dockerClient, weave, name, scope, dns, isPluginV2, forceMulticast)
|
d, err := netplugin.New(dockerClient, weave, name, scope, dns, isPluginV2, forceMulticast, procPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-8
@@ -34,7 +34,14 @@ var (
|
|||||||
bridgePortName string
|
bridgePortName string
|
||||||
)
|
)
|
||||||
|
|
||||||
func handleError(err error) { common.CheckFatal(err) }
|
func handleError(err error) {
|
||||||
|
if err != nil {
|
||||||
|
metrics.PolicyEnforcementErrors.Inc()
|
||||||
|
common.Log.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func handleFatal(err error) { common.CheckFatal(err) }
|
||||||
|
|
||||||
func makeController(getter cache.Getter, resource string,
|
func makeController(getter cache.Getter, resource string,
|
||||||
objType runtime.Object, handlers cache.ResourceEventHandlerFuncs) cache.Controller {
|
objType runtime.Object, handlers cache.ResourceEventHandlerFuncs) cache.Controller {
|
||||||
@@ -240,19 +247,19 @@ func root(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config, err := rest.InClusterConfig()
|
config, err := rest.InClusterConfig()
|
||||||
handleError(err)
|
handleFatal(err)
|
||||||
|
|
||||||
client, err := kubernetes.NewForConfig(config)
|
client, err := kubernetes.NewForConfig(config)
|
||||||
handleError(err)
|
handleFatal(err)
|
||||||
|
|
||||||
ipt, err := iptables.New()
|
ipt, err := iptables.New()
|
||||||
handleError(err)
|
handleFatal(err)
|
||||||
|
|
||||||
ips := ipset.New(common.LogLogger(), maxList)
|
ips := ipset.New(common.LogLogger(), maxList)
|
||||||
|
|
||||||
handleError(resetIPTables(ipt))
|
handleFatal(resetIPTables(ipt))
|
||||||
handleError(resetIPSets(ips))
|
handleFatal(resetIPSets(ips))
|
||||||
handleError(createBaseRules(ipt, ips))
|
handleFatal(createBaseRules(ipt, ips))
|
||||||
|
|
||||||
npc := npc.New(nodeName, ipt, ips, client)
|
npc := npc.New(nodeName, ipt, ips, client)
|
||||||
|
|
||||||
@@ -339,5 +346,5 @@ func main() {
|
|||||||
rootCmd.PersistentFlags().IntVar(&maxList, "max-list-size", 1024, "maximum size of ipset list (for namespaces)")
|
rootCmd.PersistentFlags().IntVar(&maxList, "max-list-size", 1024, "maximum size of ipset list (for namespaces)")
|
||||||
rootCmd.PersistentFlags().StringVar(&bridgePortName, "bridge-port-name", "vethwe-bridge", "name of the brige port on which packets are received and sent")
|
rootCmd.PersistentFlags().StringVar(&bridgePortName, "bridge-port-name", "vethwe-bridge", "name of the brige port on which packets are received and sent")
|
||||||
|
|
||||||
handleError(rootCmd.Execute())
|
handleFatal(rootCmd.Execute())
|
||||||
}
|
}
|
||||||
@@ -453,6 +453,7 @@ func main() {
|
|||||||
|
|
||||||
pluginConfig.DNS = !noDNS
|
pluginConfig.DNS = !noDNS
|
||||||
pluginConfig.DefaultSubnet = defaultSubnet.String()
|
pluginConfig.DefaultSubnet = defaultSubnet.String()
|
||||||
|
pluginConfig.ProcPath = procPath
|
||||||
plugin := plugin.NewPlugin(pluginConfig)
|
plugin := plugin.NewPlugin(pluginConfig)
|
||||||
|
|
||||||
// The weave script always waits for a status call to succeed,
|
// The weave script always waits for a status call to succeed,
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ search_type: Documentation
|
|||||||
The following topics are discussed:
|
The following topics are discussed:
|
||||||
|
|
||||||
* [Installation](#install)
|
* [Installation](#install)
|
||||||
|
* [Installing on GKE](#gke)
|
||||||
|
* [Installing on EKS](#eks)
|
||||||
* [Upgrading the Daemon Sets](#daemon-sets)
|
* [Upgrading the Daemon Sets](#daemon-sets)
|
||||||
* [CPU and Memory Requirements](#resources)
|
* [CPU and Memory Requirements](#resources)
|
||||||
* [Pod Eviction](#eviction)
|
* [Pod Eviction](#eviction)
|
||||||
@@ -71,10 +73,26 @@ Shut down Kubernetes, and _on all nodes_ perform the following:
|
|||||||
Then relaunch Kubernetes and install the addon as described
|
Then relaunch Kubernetes and install the addon as described
|
||||||
above.
|
above.
|
||||||
|
|
||||||
**Note:** Installing on GKE
|
### <a name="gke"></a> Installing on GKE
|
||||||
Please note that you must grant the user the ability to create roles in Kubernetes before launching Weave Net.
|
Please note that you must grant the user the ability to create roles in Kubernetes before launching Weave Net.
|
||||||
This is a prerequisite to use use role-based access control on GKE. Please see the GKE [instructions](https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control).
|
This is a prerequisite to use use role-based access control on GKE. Please see the GKE [instructions](https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control).
|
||||||
|
|
||||||
|
### <a name="gke"></a> Installing on EKS
|
||||||
|
|
||||||
|
EKS by default installs `amazon-vpc-cni-k8s` CNI. Please follow below steps to use Weave-net as CNI
|
||||||
|
|
||||||
|
- create EKS cluster in any of [prescribed](https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html) way
|
||||||
|
- delete `amazon-vpc-cni-k8s` deamonset by running `kubectl delete ds aws-node -n kube-system` command
|
||||||
|
- delete `/etc/cni/net.d/10-aws.conflist` on each of the node
|
||||||
|
- edit instance security group to allow TCP 6783 and UDP 6783/6784 ports
|
||||||
|
- flush iptables nat, mangle, filter tables to clear any iptables configurations done by `amazon-vpc-cni-k8s`
|
||||||
|
- restart kube-proxy pods to reconfigure iptables
|
||||||
|
- apply weave-net daemoset by following above installation steps
|
||||||
|
- delete existing pods so they get recreated in Weave pod CIDR's address-space.
|
||||||
|
|
||||||
|
Please note that while pods can connect to the Kubernetes API server for your cluser, API server will not be able to connect to the pods as API server nodes are not connected to Weave Net (they run on network managed by EKS).
|
||||||
|
|
||||||
|
|
||||||
### <a name="daemon-sets"></a> Upgrading the Daemon Sets
|
### <a name="daemon-sets"></a> Upgrading the Daemon Sets
|
||||||
|
|
||||||
The DaemonSet definition specifies [Rolling
|
The DaemonSet definition specifies [Rolling
|
||||||
|
|||||||
@@ -483,6 +483,7 @@ destroy_bridge() {
|
|||||||
|
|
||||||
[ -n "$DOCKER_BRIDGE_IP" ] || DOCKER_BRIDGE_IP=$(util_op bridge-ip $DOCKER_BRIDGE)
|
[ -n "$DOCKER_BRIDGE_IP" ] || DOCKER_BRIDGE_IP=$(util_op bridge-ip $DOCKER_BRIDGE)
|
||||||
|
|
||||||
|
run_iptables -t filter -D INPUT -d 127.0.0.1/32 -p tcp -m addrtype ! --src-type LOCAL -m conntrack ! --ctstate RELATED,ESTABLISHED -j DROP >/dev/null 2>&1 || true
|
||||||
run_iptables -t filter -D INPUT -i $DOCKER_BRIDGE -p udp --dport 53 -j ACCEPT >/dev/null 2>&1 || true
|
run_iptables -t filter -D INPUT -i $DOCKER_BRIDGE -p udp --dport 53 -j ACCEPT >/dev/null 2>&1 || true
|
||||||
run_iptables -t filter -D INPUT -i $DOCKER_BRIDGE -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1 || true
|
run_iptables -t filter -D INPUT -i $DOCKER_BRIDGE -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user