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 10, 2024
1 parent c2c6c5d commit 4fa847f
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 @@ -565,6 +565,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, autoSetup bool) error {
_, bootstrap := systems[sh.Name]
lxd := sh.Services[types.LXD].(*service.LXDService)
Expand Down Expand Up @@ -596,7 +609,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 @@ -605,7 +618,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 @@ -634,7 +647,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 4fa847f

Please sign in to comment.