diff --git a/cmd/installer/autoinstall/autoinstall.go b/cmd/installer/autoinstall/autoinstall.go index 3fdaa38b5..792928cc7 100644 --- a/cmd/installer/autoinstall/autoinstall.go +++ b/cmd/installer/autoinstall/autoinstall.go @@ -151,6 +151,10 @@ func buildConfig() (*install.Config, error) { cfg.JoinAddr = joinAddr } + if os.Getenv("SPINIFEX_SKIP_FORMATION") == "1" { + cfg.SkipFormation = true + } + return cfg, nil } diff --git a/cmd/installer/firstboot/firstboot.go b/cmd/installer/firstboot/firstboot.go index 1654771f7..8ec289d24 100644 --- a/cmd/installer/firstboot/firstboot.go +++ b/cmd/installer/firstboot/firstboot.go @@ -52,6 +52,10 @@ type Config struct { // and network failures are swallowed so the install is not gated on // controller reachability. InstallCallback string + // SkipFormation skips spx admin init/join. Used when a provisioning + // controller (e.g. bm-bootstrap.sh) owns cluster formation and will call + // spx admin init/join itself with the correct multi-node parameters. + SkipFormation bool } // Write drops the firstboot script and systemd unit into root, which should be @@ -232,6 +236,9 @@ fi } func buildClusterCmd(cfg Config) string { + if cfg.SkipFormation { + return `echo "[firstboot] cluster formation skipped — provisioning controller will handle it"` + } emailFlag := "" if cfg.Email != "" { // shellEscapeSingle keeps the email safe if it ever contains a diff --git a/cmd/installer/install/config.go b/cmd/installer/install/config.go index 657adc48c..6debbd9d9 100644 --- a/cmd/installer/install/config.go +++ b/cmd/installer/install/config.go @@ -55,6 +55,10 @@ type Config struct { // JoinAddr is the primary node address (host:port) when ClusterRole is "join". JoinAddr string + // SkipFormation skips spx admin init/join in firstboot; the provisioning + // controller (e.g. bm-bootstrap.sh) owns cluster formation instead. + SkipFormation bool + // CA certificate (PEM), optional. HasCACert bool CACert string diff --git a/cmd/installer/install/install.go b/cmd/installer/install/install.go index 6bc7d4a45..809ad8858 100644 --- a/cmd/installer/install/install.go +++ b/cmd/installer/install/install.go @@ -696,6 +696,7 @@ func (c *Config) toFirstbootConfig() firstboot.Config { JoinAddr: c.JoinAddr, Email: c.Email, InstallCallback: strings.TrimSpace(os.Getenv("SPINIFEX_INSTALL_CALLBACK")), + SkipFormation: c.SkipFormation, } }