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 bef6a0c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/microcloud/ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,18 @@ 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]
Expand Down Expand Up @@ -596,7 +608,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 +617,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 +646,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 bef6a0c

Please sign in to comment.