Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-1.30] Skip kube-bridge interface for api/etcd address #4475

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading