Skip to content

Commit

Permalink
baremetal: move provisioning out of configmap wait
Browse files Browse the repository at this point in the history
  • Loading branch information
honza committed Apr 11, 2024
1 parent c2dfbe9 commit b868bb9
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions cmd/openshift-install/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,55 +436,53 @@ func waitForBootstrapComplete(ctx context.Context, config *rest.Config) *cluster
return newAPIError(err)
}

if err := waitForBootstrapConfigMap(ctx, config, client); err != nil {
return err
}

if err := waitForStableSNOBootstrap(ctx, config); err != nil {
return newBootstrapError(err)
}

return nil
}

// waitForBootstrapConfigMap watches the configmaps in the kube-system namespace
// and waits for the bootstrap configmap to report that bootstrapping has
// completed.
func waitForBootstrapConfigMap(ctx context.Context, config *rest.Config, client *kubernetes.Clientset) *clusterCreateError {
timeout := 30 * time.Minute

platformName := ""
var platformName string

if assetStore, err := assetstore.NewStore(command.RootOpts.Dir); err == nil {
if installConfig, err := assetStore.Load(&installconfig.InstallConfig{}); err == nil && installConfig != nil {
platformName = installConfig.(*installconfig.InstallConfig).Config.Platform.Name()
}
}

timeout := 30 * time.Minute

// Wait longer for baremetal, VSphere due to length of time it takes to boot
if platformName == baremetal.Name || platformName == vsphere.Name {
timeout = 60 * time.Minute
}

untilTime := time.Now().Add(timeout)
timezone, _ := untilTime.Zone()
untilTime = time.Now().Add(timeout)
timezone, _ = untilTime.Zone()
logrus.Infof("Waiting up to %v (until %v %s) for bootstrapping to complete...",
timeout, untilTime.Format(time.Kitchen), timezone)

waitCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()

// baremetal: monitor control plane bootstrapping progress
if platformName == baremetal.Name {
if err := baremetalutils.WaitForBaremetalBootstrapControlPlane(waitCtx, config); err != nil {
if err := baremetalutils.WaitForBaremetalBootstrapControlPlane(waitCtx, config, command.RootOpts.Dir); err != nil {
return newBootstrapError(err)
}

logrus.Infof(" Baremetal control plane finished provisioning.")
}

if err := waitForBootstrapConfigMap(waitCtx, client); err != nil {
return err
}

if err := waitForStableSNOBootstrap(ctx, config); err != nil {
return newBootstrapError(err)
}

return nil
}

// waitForBootstrapConfigMap watches the configmaps in the kube-system namespace
// and waits for the bootstrap configmap to report that bootstrapping has
// completed.
func waitForBootstrapConfigMap(ctx context.Context, client *kubernetes.Clientset) *clusterCreateError {
_, err := clientwatch.UntilWithSync(
waitCtx,
ctx,
cache.NewListWatchFromClient(client.CoreV1().RESTClient(), "configmaps", "kube-system", fields.OneTermEqualSelector("metadata.name", "bootstrap")),
&corev1.ConfigMap{},
nil,
Expand Down

0 comments on commit b868bb9

Please sign in to comment.