Skip to content

Commit

Permalink
fix duplicate log for tunnel interface decision (#1823)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 18, 2022
1 parent b25f58f commit 02a4caf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (

// Configuration is the daemon conf
type Configuration struct {
// interface being used for tunnel
tunnelIface string
Iface string
DPDKTunnelIface string
MTU int
Expand Down Expand Up @@ -205,7 +207,10 @@ func (config *Configuration) initNicConfig(nicBridgeMappings map[string]string)
if len(encapIP) == 0 {
return fmt.Errorf("iface %s has no valid IP address", tunnelNic)
}

klog.Infof("use %s as tunnel interface", iface.Name)
mtu = iface.MTU
config.tunnelIface = iface.Name
}

encapIsIPv6 := util.CheckProtocol(encapIP) == kubeovnv1.ProtocolIPv6
Expand Down Expand Up @@ -278,7 +283,6 @@ func findInterface(ifaceStr string) (*net.Interface, error) {
}
for _, iface := range ifaces {
if ifaceRegex.MatchString(iface.Name) {
klog.Infof("use %s as tunnel interface", iface.Name)
return &iface, nil
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/daemon/controller_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ func (c *Controller) loopEncapIpCheck() {
klog.Errorf("iface %s has no ip address", nodeTunnelName)
return
}
if iface.Name != c.config.tunnelIface {
klog.Infof("use %s as tunnel interface", iface.Name)
c.config.tunnelIface = iface.Name
}

// if assigned iface in node annotation is down or with no ip, the error msg should be printed periodically
if c.config.Iface == nodeTunnelName {
Expand Down

0 comments on commit 02a4caf

Please sign in to comment.