mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2025-11-18 19:41:05 +01:00
fix: remove multiple MTU reductions
fixes cloudnativelabs#1033
This commit is contained in:
parent
c93178df28
commit
f97eb7cc1a
@ -2347,7 +2347,7 @@ func NewNetworkServicesController(clientset kubernetes.Interface,
|
||||
return nil, err
|
||||
}
|
||||
nsc.nodeIP = NodeIP
|
||||
automtu, err := utils.GetMTUFromNodeIP(nsc.nodeIP, config.EnableOverlay)
|
||||
automtu, err := utils.GetMTUFromNodeIP(nsc.nodeIP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *healthcheck.Controll
|
||||
}
|
||||
|
||||
if nrc.autoMTU {
|
||||
mtu, err := utils.GetMTUFromNodeIP(nrc.nodeIP, nrc.enableOverlays)
|
||||
mtu, err := utils.GetMTUFromNodeIP(nrc.nodeIP)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to find MTU for node IP: %s for intelligently setting the kube-bridge MTU "+
|
||||
"due to %s.", nrc.nodeIP, err.Error())
|
||||
@ -401,7 +401,7 @@ func (nrc *NetworkRoutingController) updateCNIConfig() {
|
||||
}
|
||||
|
||||
func (nrc *NetworkRoutingController) autoConfigureMTU() error {
|
||||
mtu, err := utils.GetMTUFromNodeIP(nrc.nodeIP, nrc.enableOverlays)
|
||||
mtu, err := utils.GetMTUFromNodeIP(nrc.nodeIP)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate MTU: %s", err.Error())
|
||||
}
|
||||
@ -701,10 +701,6 @@ func (nrc *NetworkRoutingController) setupOverlayTunnel(tunnelName string, nextH
|
||||
if err = netlink.LinkSetUp(link); err != nil {
|
||||
return nil, errors.New("Failed to bring tunnel interface " + tunnelName + " up due to: " + err.Error())
|
||||
}
|
||||
// reduce the MTU by 20 bytes to accommodate ipip tunnel overhead
|
||||
if err = netlink.LinkSetMTU(link, link.Attrs().MTU-utils.IPInIPHeaderLength); err != nil {
|
||||
return nil, errors.New("Failed to set MTU of tunnel interface " + tunnelName + " up due to: " + err.Error())
|
||||
}
|
||||
} else {
|
||||
klog.V(1).Infof(
|
||||
"Tunnel interface: " + tunnelName + " for the node " + nextHop.String() + " already exists.")
|
||||
|
||||
@ -63,7 +63,7 @@ func GetNodeIP(node *apiv1.Node) (net.IP, error) {
|
||||
}
|
||||
|
||||
// GetMTUFromNodeIP returns the MTU by detecting it from the IP on the node and figuring in tunneling configurations
|
||||
func GetMTUFromNodeIP(nodeIP net.IP, overlayEnabled bool) (int, error) {
|
||||
func GetMTUFromNodeIP(nodeIP net.IP) (int, error) {
|
||||
links, err := netlink.LinkList()
|
||||
if err != nil {
|
||||
return 0, errors.New("failed to get list of links")
|
||||
@ -76,9 +76,6 @@ func GetMTUFromNodeIP(nodeIP net.IP, overlayEnabled bool) (int, error) {
|
||||
for _, addr := range addresses {
|
||||
if addr.IPNet.IP.Equal(nodeIP) {
|
||||
linkMTU := link.Attrs().MTU
|
||||
if overlayEnabled {
|
||||
return linkMTU - IPInIPHeaderLength, nil // -20 to accommodate IPIP header
|
||||
}
|
||||
return linkMTU, nil
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user