Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -1400,10 +1400,6 @@ func (dn *Daemon) checkStateOnFirstRun() error {
return fmt.Errorf("error detecting previous SSH accesses: %w", err)
}

if err := dn.removeRollback(); err != nil {
return fmt.Errorf("Failed to remove rollback: %w", err)
}

// Bootstrapping state is when we have the node annotations file
if state.bootstrapping {
targetOSImageURL := state.currentConfig.Spec.OSImageURL
Expand Down
11 changes: 11 additions & 0 deletions pkg/daemon/rpm-ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type NodeUpdaterClient interface {
Initialize() error
GetStatus() (string, error)
GetBootedOSImageURL() (string, string, error)
CleanupRollback() error
Rebase(string, string) (bool, error)
GetBootedDeployment() (*RpmOstreeDeployment, error)
}
Expand Down Expand Up @@ -162,6 +163,16 @@ func (r *RpmOstreeClient) GetStatus() (string, error) {
return string(output), nil
}

// CleanupRollback removes the rpm-ostree rollback deployment.
// It takes up space and can cause issues when /boot contains multiple
// initramfs images: https://bugzilla.redhat.com/show_bug.cgi?id=2104619.
// We don't generally expect administrators to use this versus e.g. removing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can update message here to align with removing rollback deployment during OS update.

// broken configuration. We only remove the rollback once the MCD pod has
// landed on a node, so we know kubelet is working.
func (r *RpmOstreeClient) CleanupRollback() error {
return runRpmOstree("cleanup", "-r")
}

// GetBootedOSImageURL returns the image URL as well as the OSTree version (for logging)
// Returns the empty string if the host doesn't have a custom origin that matches pivot://
// (This could be the case for e.g. FCOS, or a future RHCOS which comes not-pivoted by default)
Expand Down
4 changes: 4 additions & 0 deletions pkg/daemon/rpm-ostree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (r RpmOstreeClientMock) GetStatus() (string, error) {
return "rpm-ostree mock: blah blah some status here", nil
}

func (r RpmOstreeClientMock) CleanupRollback() error {
return nil
}

func (r RpmOstreeClientMock) GetBootedDeployment() (*RpmOstreeDeployment, error) {
return &RpmOstreeDeployment{}, nil
}
17 changes: 3 additions & 14 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ func (dn *CoreOSDaemon) applyOSChanges(mcDiff machineConfigDiff, oldConfig, newC

// Update OS
if mcDiff.osUpdate {
if err := dn.NodeUpdaterClient.CleanupRollback(); err != nil {
return err
}
if err := updateOS(newConfig, osImageContentDir); err != nil {
nodeName := ""
if dn.node != nil {
Expand Down Expand Up @@ -720,20 +723,6 @@ func (dn *Daemon) updateHypershift(oldConfig, newConfig *mcfgv1.MachineConfig, d
return nil
}

// removeRollback removes the rpm-ostree rollback deployment.
// It takes up space and can cause issues when /boot contains multiple
// initramfs images: https://bugzilla.redhat.com/show_bug.cgi?id=2104619.
// We don't generally expect administrators to use this versus e.g. removing
// broken configuration. We only remove the rollback once the MCD pod has
// landed on a node, so we know kubelet is working.
func (dn *Daemon) removeRollback() error {
if !dn.os.IsCoreOSVariant() {
// do not attempt to rollback on non-RHCOS/FCOS machines
return nil
}
return runRpmOstree("cleanup", "-r")
}

// machineConfigDiff represents an ad-hoc difference between two MachineConfig objects.
// At some point this may change into holding just the files/units that changed
// and the MCO would just operate on that. For now we're just doing this to get
Expand Down