Skip to content

Commit

Permalink
Reintroduce K0smotronNetworks in tests
Browse files Browse the repository at this point in the history
Custom docker networks were removed in k0sproject#3602 because the custom networks
were revealing issues in our test suite.

This effectively means k0smotron cannot bump the k0s dependency to a
newer version.

This is a partial revert of 57b5560 getting only the minimum subset that
we require for k0smotron.

Signed-off-by: Juan-Luis de Sousa-Valadas Castaño <[email protected]>
  • Loading branch information
juanluisvaladas committed Sep 2, 2024
1 parent 04e0ad7 commit 2ffeb8f
Showing 1 changed file with 18 additions and 0 deletions.
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

0 comments on commit 2ffeb8f

Please sign in to comment.