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 e4d5321 commit 1c3b622
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
Expand Up @@ -26,6 +26,8 @@ import (

// Configuration is the daemon conf
type Configuration struct {
// interface being used for tunnel
tunnelIface string
Iface string
MTU int
MSS int
Expand Down Expand Up @@ -178,6 +180,9 @@ func (config *Configuration) initNicConfig(nicBridgeMappings map[string]string)
return fmt.Errorf("iface %s has no ip address", tunnelNic)
}
encapIP = strings.Split(addrs[0].String(), "/")[0]

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

if config.MTU == 0 {
Expand Down Expand Up @@ -211,7 +216,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.go
Expand Up @@ -1016,6 +1016,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 1c3b622

Please sign in to comment.