Merge pull request #5215 from rbrtbnfgl/flannel_0.17

Flannel 0.17
pull/5254/head
Roberto Bonafiglia 3 years ago committed by GitHub
commit 93346904cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -72,7 +72,7 @@ require (
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/docker/docker v20.10.10+incompatible github.com/docker/docker v20.10.10+incompatible
github.com/erikdubbelboer/gspt v0.0.0-20190125194910-e68493906b83 github.com/erikdubbelboer/gspt v0.0.0-20190125194910-e68493906b83
github.com/flannel-io/flannel v0.16.3 github.com/flannel-io/flannel v0.17.0
github.com/go-bindata/go-bindata v3.1.2+incompatible github.com/go-bindata/go-bindata v3.1.2+incompatible
github.com/go-sql-driver/mysql v1.6.0 github.com/go-sql-driver/mysql v1.6.0
github.com/golangplus/testing v1.0.0 // indirect github.com/golangplus/testing v1.0.0 // indirect

@ -327,8 +327,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flannel-io/flannel v0.16.3 h1:aRWrfH71g5kcUOb4HuMp1BmXlGNCHw+oAH24RZdfqM8= github.com/flannel-io/flannel v0.17.0 h1:agLlERKtRiaDfDLe+gY98D1gAP8rRQGOGUxNbPr4JPg=
github.com/flannel-io/flannel v0.16.3/go.mod h1:GBQXj8+IwLASA6y83KhF9qdpUQ7ngtZ67tzY9nZvVl8= github.com/flannel-io/flannel v0.17.0/go.mod h1:GBQXj8+IwLASA6y83KhF9qdpUQ7ngtZ67tzY9nZvVl8=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=

@ -91,8 +91,8 @@ func flannel(ctx context.Context, flannelIface *net.Interface, flannelConf, kube
} }
func LookupExtInterface(iface *net.Interface, netMode int) (*backend.ExternalInterface, error) { func LookupExtInterface(iface *net.Interface, netMode int) (*backend.ExternalInterface, error) {
var ifaceAddr net.IP var ifaceAddr []net.IP
var ifacev6Addr net.IP var ifacev6Addr []net.IP
var err error var err error
if iface == nil { if iface == nil {
@ -103,30 +103,47 @@ func LookupExtInterface(iface *net.Interface, netMode int) (*backend.ExternalInt
} }
logrus.Debugf("The interface %s will be used by flannel", iface.Name) logrus.Debugf("The interface %s will be used by flannel", iface.Name)
ifaceAddr, err = ip.GetInterfaceIP4Addr(iface) switch netMode {
case ipv4:
ifaceAddr, err = ip.GetInterfaceIP4Addrs(iface)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to find IPv4 address for interface %s", iface.Name) return nil, fmt.Errorf("failed to find IPv4 address for interface %s", iface.Name)
} }
logrus.Infof("The interface %s with ipv4 address %s will be used by flannel", iface.Name, ifaceAddr) logrus.Infof("The interface %s with ipv4 address %s will be used by flannel", iface.Name, ifaceAddr[0])
ifacev6Addr = append(ifacev6Addr, nil)
if netMode == (ipv4 + ipv6) { case ipv6:
ifacev6Addr, err = ip.GetInterfaceIP6Addr(iface) ifacev6Addr, err = ip.GetInterfaceIP6Addrs(iface)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to find IPv6 address for interface %s", iface.Name) return nil, fmt.Errorf("failed to find IPv6 address for interface %s", iface.Name)
} }
logrus.Infof("The interface %s with ipv6 address %s will be used by flannel", iface.Name, ifacev6Addr[0])
logrus.Infof("Using dual-stack mode. The ipv6 address %s will be used by flannel", ifacev6Addr) ifaceAddr = append(ifaceAddr, nil)
case (ipv4 + ipv6):
ifaceAddr, err = ip.GetInterfaceIP4Addrs(iface)
if err != nil {
return nil, fmt.Errorf("failed to find IPv4 address for interface %s", iface.Name)
} }
logrus.Infof("The interface %s with ipv4 address %s will be used by flannel", iface.Name, ifaceAddr[0])
ifacev6Addr, err = ip.GetInterfaceIP6Addrs(iface)
if err != nil {
return nil, fmt.Errorf("failed to find IPv6 address for interface %s", iface.Name)
}
logrus.Infof("Using dual-stack mode. The ipv6 address %s will be used by flannel", ifacev6Addr[0])
default:
ifaceAddr = append(ifaceAddr, nil)
ifacev6Addr = append(ifacev6Addr, nil)
}
if iface.MTU == 0 { if iface.MTU == 0 {
return nil, fmt.Errorf("failed to determine MTU for %s interface", ifaceAddr) return nil, fmt.Errorf("failed to determine MTU for %s interface", iface.Name)
} }
return &backend.ExternalInterface{ return &backend.ExternalInterface{
Iface: iface, Iface: iface,
IfaceAddr: ifaceAddr, IfaceAddr: ifaceAddr[0],
IfaceV6Addr: ifacev6Addr, IfaceV6Addr: ifacev6Addr[0],
ExtAddr: ifaceAddr, ExtAddr: ifaceAddr[0],
ExtV6Addr: ifacev6Addr, ExtV6Addr: ifacev6Addr[0],
}, nil }, nil
} }

Loading…
Cancel
Save