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

Reintroduce K0smotronNetworks in tests #4927

Closed
Closed
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
18 changes: 18 additions & 0 deletions inttest/common/bootloosesuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type BootlooseSuite struct {
K0smotronWorkerCount int
WithUpdateServer bool
BootLooseImage string
K0smotronNetworks []string

ctx context.Context
tearDown func()
Expand Down Expand Up @@ -612,6 +613,22 @@ func (s *BootlooseSuite) getControllersIPAddresses() []string {

machines, err := s.InspectMachines(upstreams)

// If a network is supplied, the address will need to be obtained from there.
// We only apply this logic in k0smotron as it can cause issues with coreDNS.
// More info available in github.com/k0sproject/k0s/pull/3602
if len(s.K0smotronNetworks) > 0 {
for i := 0; i < s.ControllerCount; i++ {
// If a network is supplied, the address will need to be obtained from there.
// Note that this currently uses the first network found.
if machines[i].Status().IP != "" {
addresses[i] = machines[i].Status().IP
} else if len(machines[i].Status().RuntimeNetworks) > 0 {
addresses[i] = machines[i].Status().RuntimeNetworks[0].IP
}
upstreams[i] = fmt.Sprintf("controller%d", i)
}
}

s.Require().NoError(err)

for i := 0; i < s.ControllerCount; i++ {
Expand Down Expand Up @@ -1195,6 +1212,7 @@ func (s *BootlooseSuite) initializeBootlooseClusterInDir(dir string) error {
Privileged: true,
Volumes: volumes,
PortMappings: portMaps,
Networks: s.K0smotronNetworks,
},
},
},
Expand Down
Loading