Skip to content

Commit

Permalink
Skip k0s VIP and calico CNI interfaces in address detection
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Nummelin <[email protected]>
  • Loading branch information
jnummelin committed Jun 11, 2024
1 parent 9ad20fe commit 76356d4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/pkg/iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package iface
import (
"fmt"
"net"
"strings"

"github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -64,8 +65,17 @@ func FirstPublicAddress() (string, error) {
}
ipv6addr := ""
for _, i := range ifs {
if i.Name == "vxlan.calico" || i.Name == "kube-bridge" {
// Skip calico and kube-router interfaces
switch {
// Skip CNI related interfaces and the k0s VIP interface
case i.Name == "vxlan.calico":
continue
case i.Name == "kube-bridge":
continue
case i.Name == "dummyvip0":
continue
case strings.HasPrefix(i.Name, "veth"):
continue
case strings.HasPrefix(i.Name, "cali"):
continue
}
addresses, err := i.Addrs()
Expand Down

0 comments on commit 76356d4

Please sign in to comment.