Skip to content

Commit 33d9f10

Browse files
committed
overlay node image before bootstrapping if necessary
As per openshift/enhancements#1637, we're trying to get rid of all OpenShift-versioned components from the bootimages. This means that there will no longer be oc, kubelet, or crio binaries for example, which bootstrapping obviously relies on. To adapt to this, the OpenShift installer now ships a new `node-image-overlay.service` in its bootstrap Ignition config. This service takes care of pulling down the node image and overlaying it, effectively updating the system to the node image version. Here, we accordingly also adapt assisted-installer so that we run `node-image-overlay.service` before starting e.g. `kubelet.service` and `bootkube.service`. See also: openshift/installer#8742
1 parent 95fa603 commit 33d9f10

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/installer/installer.go

+35
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,22 @@ func (i *installer) startBootstrap() error {
453453
return err
454454
}
455455

456+
// If we're in a pure RHEL/CentOS environment, we need to overlay the node image
457+
// first to have access to e.g. oc, kubelet, cri-o, etc...
458+
// https://github.com/openshift/enhancements/pull/1637
459+
if !i.ops.FileExists("/usr/bin/oc") {
460+
err = i.ops.SystemctlAction("start", "node-image-overlay.service")
461+
if err != nil {
462+
return err
463+
}
464+
465+
i.waitForNodeImageOverlay(context.Background())
466+
467+
if !i.ops.FileExists("/usr/bin/oc") {
468+
return stderrors.New("/usr/bin/oc still doesn't exist after node image overlay")
469+
}
470+
}
471+
456472
servicesToStart := []string{"bootkube.service", "approve-csr.service", "progress.service"}
457473
for _, service := range servicesToStart {
458474
err = i.ops.SystemctlAction("start", service)
@@ -669,6 +685,25 @@ func (i *installer) waitForBootkube(ctx context.Context) {
669685
}
670686
}
671687

688+
func (i *installer) waitForNodeImageOverlay(ctx context.Context) {
689+
i.log.Infof("Waiting for node image overlay to complete")
690+
691+
for {
692+
select {
693+
case <-ctx.Done():
694+
i.log.Info("Context cancelled, terminating wait for node image overlay\n")
695+
return
696+
case <-time.After(generalWaitInterval):
697+
out, err := i.ops.ExecPrivilegeCommand(nil, "systemctl", "is-active", "node-image-overlay.service")
698+
if err == nil {
699+
i.log.Info("node image overlay service completed")
700+
return
701+
}
702+
i.log.Debugf("node image overlay service not yet active: %s", out)
703+
}
704+
}
705+
}
706+
672707
func (i *installer) waitForController(kc k8s_client.K8SClient) error {
673708
i.log.Infof("Waiting for controller to be ready")
674709
i.UpdateHostInstallProgress(models.HostStageWaitingForController, "waiting for controller pod ready event")

0 commit comments

Comments
 (0)