Skip to content

Commit

Permalink
cmd/microcloud: Add askProceedIfNoOverlayNetwork question wheen no …
Browse files Browse the repository at this point in the history
…overlay networking solution is available

Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Jun 21, 2024
1 parent 1a7f0db commit 459de0b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions cmd/microcloud/ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,19 @@ func (c *CmdControl) askRemotePool(systems map[string]InitSystem, autoSetup bool
return nil
}

func (c *CmdControl) askProceedIfNoOverlayNetwork() error {
proceedWithNoOverlayNetworking, err := c.asker.AskBool("FAN networking is not usable. Do you want to proceed with setting up an inoperable cluster? (yes/no) [default=no]: ", "no")
if err != nil {
return err
}

if proceedWithNoOverlayNetworking {
return nil
}

return fmt.Errorf("cluster bootstrapping aborted due to lack of usable networking")
}

func (c *CmdControl) askNetwork(sh *service.Handler, systems map[string]InitSystem, microCloudInternalSubnet *net.IPNet, autoSetup bool) error {
_, bootstrap := systems[sh.Name]
lxd := sh.Services[types.LXD].(*service.LXDService)
Expand Down Expand Up @@ -656,7 +669,7 @@ func (c *CmdControl) askNetwork(sh *service.Handler, systems map[string]InitSyst
// Automatic setup gets a basic fan setup.
if autoSetup {
if !fanUsable {
fmt.Println("FAN networking is not usable, skipping")
return c.askProceedIfNoOverlayNetwork()
}

return nil
Expand All @@ -665,7 +678,7 @@ func (c *CmdControl) askNetwork(sh *service.Handler, systems map[string]InitSyst
// Environments without OVN get a basic fan setup.
if sh.Services[types.MicroOVN] == nil {
if !fanUsable {
fmt.Println("FAN networking is not usable, skipping")
return c.askProceedIfNoOverlayNetwork()
}

return nil
Expand Down Expand Up @@ -787,7 +800,7 @@ func (c *CmdControl) askNetwork(sh *service.Handler, systems map[string]InitSyst
if !canOVN {
fmt.Println("No dedicated uplink interfaces detected, skipping distributed networking")
if !fanUsable {
fmt.Println("FAN networking is not usable, skipping")
return c.askProceedIfNoOverlayNetwork()
}

return nil
Expand Down

0 comments on commit 459de0b

Please sign in to comment.