Skip to content

Commit

Permalink
Support vxlan mode of calico.
Browse files Browse the repository at this point in the history
Signed-off-by: Zhen Tang <[email protected]>
  • Loading branch information
lostcharlie committed Jul 28, 2023
1 parent 4b7e139 commit 5c484d0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/connector/routing/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,18 @@ func getFlannelLocalPrefixes() (lp4, lp6 []string, err error) {
}

func getCalicoLocalPrefixes() (lp4, lp6 []string, err error) {
tunl, err := netlink.LinkByName("tunl0")
var device netlink.Link
device, err = netlink.LinkByName("vxlan.calico")
if err != nil {
return nil, nil, err
logger.Error(err, "failed to get device vxlan.calico, trying tunl0.")
device, err = netlink.LinkByName("tunl0")
if err != nil {
logger.Error(err, "failed to find calico interface.")
return nil, nil, err
}
}

addrs, err := netlink.AddrList(tunl, netlink.FAMILY_ALL)
addrs, err := netlink.AddrList(device, netlink.FAMILY_ALL)
if err != nil {
return nil, nil, err
}
Expand All @@ -141,6 +147,7 @@ func getCalicoLocalPrefixes() (lp4, lp6 []string, err error) {
lp6 = append(lp6, ipNet.String())
}
}
logger.Info("Calico IP address: IPv4 = " + strings.Join(lp4, ",") + ", IPv6 = " + strings.Join(lp6, ","))

return lp4, lp6, nil
}
Expand Down

0 comments on commit 5c484d0

Please sign in to comment.