Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon: Remove rollback deployment #2220

Merged
merged 1 commit into from
Nov 19, 2020
Merged
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: 4 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,10 @@ func (dn *Daemon) checkStateOnFirstRun() error {
return fmt.Errorf("error detecting previous SSH accesses: %v", err)
}

if err := dn.removeRollback(); err != nil {
return errors.Wrapf(err, "Failed to remove rollback")
}

// Bootstrapping state is when we have the node annotations file
if state.bootstrapping {
targetOSImageURL := state.currentConfig.Spec.OSImageURL
Expand Down
10 changes: 10 additions & 0 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,16 @@ func (dn *Daemon) update(oldConfig, newConfig *mcfgv1.MachineConfig) (retErr err
return dn.finalizeAndReboot(newConfig)
}

// removeRollback removes the rpm-ostree rollback deployment. It
// takes up space, and 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 {
_, err := runGetOut("rpm-ostree", "cleanup", "-r")
Copy link
Contributor

Choose a reason for hiding this comment

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

haven't checked myself, does rpm-ostree return success if there is no rollback deployment available to delete?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, it's a no-op if not present.

return err
}

// 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