Skip to content

Commit

Permalink
Test that kubeconfig returns externalAddress
Browse files Browse the repository at this point in the history
Add a test to verify that the server address is set to externalAddress
when it is set, and that the custom ports are included in the
kubeconfig.

This is a test for issue k0sproject#1202

Signed-off-by: Natanael Copa <[email protected]>
  • Loading branch information
ncopa committed Jan 11, 2022
1 parent ec97796 commit eac0185
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inttest/customports/customports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package customports
import (
"bytes"
"context"
"fmt"
"html/template"
"testing"

Expand Down Expand Up @@ -135,4 +136,15 @@ func (ds *Suite) TestControllerJoinsWithCustomPort() {

ds.T().Log("waiting to get logs from pods")
ds.Require().NoError(common.WaitForPodLogs(kc, "kube-system"))

// https://github.com/k0sproject/k0s/issues/1202
ds.T().Log("test that kubeconfig includes externalAddress")
ssh, err := ds.SSH(ds.ControllerNode(0))
ds.Require().NoError(err)
defer ssh.Disconnect()

out, err := ssh.ExecWithOutput("k0s kubeconfig create user | awk '$1 == \"server:\" {print $2}'")
ds.Require().NoError(err)
ds.Require().Equal(fmt.Sprintf("https://%s:%d", ipAddress, kubeAPIPort), out)

}

0 comments on commit eac0185

Please sign in to comment.