Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,25 @@ func (dn *Daemon) updateOS(config *mcfgv1.MachineConfig) error {
}

glog.Infof("Updating OS to %s", newURL)
if err := dn.NodeUpdaterClient.RunPivot(newURL); err != nil {
MCDPivotErr.WithLabelValues(newURL, err.Error()).SetToCurrentTime()
return fmt.Errorf("failed to run pivot: %v", err)
// In the cluster case, for now we run indirectly via machine-config-daemon-host.service
// for SELinux reasons, see https://bugzilla.redhat.com/show_bug.cgi?id=1839065
if dn.kubeClient != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering instead of checking for kubeClient if we should check for /etc/ignition-machine-config-encapsulated.json file existence.

if err := dn.NodeUpdaterClient.RunPivot(newURL); err != nil {
MCDPivotErr.WithLabelValues(newURL, err.Error()).SetToCurrentTime()
return fmt.Errorf("failed to run pivot: %v", err)
}
} else {
// If we're here we're invoked via `machine-config-daemon-firstboot.service`, so let's
// just run the update directly rather than invoking another service.
client := NewNodeUpdaterClient()
_, changed, err := client.PullAndRebase(newURL, false)
if err != nil {
return err
}
if !changed {
// This really shouldn't happen
glog.Warningf("Didn't change when updating to %s ?", newURL)
}
}

return nil
Expand Down