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 3d966bf commit c3f23af
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 @@ -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 @@ -174,6 +176,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 @@ -207,7 +212,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
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,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 c3f23af

Please sign in to comment.