Skip to content

Commit

Permalink
Merge pull request #4654 from k0sproject/backport-4640-to-release-1.27
Browse files Browse the repository at this point in the history
[Backport release-1.27] Skip k0s VIP and calico CNI interfaces in address detection
  • Loading branch information
twz123 authored Jun 18, 2024
2 parents 89efef0 + c5c217e commit 0aa9179
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 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,21 @@ 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 calico CNI interface
case i.Name == "vxlan.calico":
continue
// Skip kube-router CNI interface
case i.Name == "kube-bridge":
continue
// Skip k0s CPLB interface
case i.Name == "dummyvip0":
continue
// Skip kube-router pod CNI interfaces
case strings.HasPrefix(i.Name, "veth"):
continue
// Skip calico pod CNI interfaces
case strings.HasPrefix(i.Name, "cali"):
continue
}
addresses, err := i.Addrs()
Expand Down

0 comments on commit 0aa9179

Please sign in to comment.