Skip to content

Commit

Permalink
Merge pull request #4474 from k0sproject/backport-4467-to-release-1.29
Browse files Browse the repository at this point in the history
[Backport release-1.29] Skip `kube-bridge` interface for api/etcd address
  • Loading branch information
twz123 authored May 23, 2024
2 parents eceeea9 + 0cca457 commit a69267d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/iface/iface.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func FirstPublicAddress() (string, error) {
}
ipv6addr := ""
for _, i := range ifs {
if i.Name == "vxlan.calico" {
// Skip calico interface
if i.Name == "vxlan.calico" || i.Name == "kube-bridge" {
// Skip calico and kube-router interfaces
continue
}
addresses, err := i.Addrs()
Expand Down
13 changes: 13 additions & 0 deletions inttest/singlenode/singlenode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ import (
"testing"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/yaml"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/k0sproject/k0s/inttest/common"
"github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -106,6 +108,17 @@ func (s *SingleNodeSuite) TestK0sGetsUp() {
_, err = ssh.ExecWithOutput(s.Context(), "test -e /var/lib/k0s/bin/etcd && ps xa | grep etcd")
assert.NoError(t, err)
})

t.Run("no kube-bridge address in default config", func(t *testing.T) {
cfg, err := ssh.ExecWithOutput(s.Context(), "k0s config create")
assert.NoError(t, err)
config := &v1beta1.ClusterConfig{}
assert.NoError(t, yaml.Unmarshal([]byte(cfg), config))

assert.NotEqual(t, "10.244.0.1", config.Spec.API.Address)
assert.NotEqual(t, "10.244.0.1", config.Spec.Storage.Etcd.PeerAddress)

})
})
}

Expand Down

0 comments on commit a69267d

Please sign in to comment.