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

Bug 2104619: Remove rollback deployment #3243

Merged
merged 2 commits into from
Jul 13, 2022
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 @@ -1400,6 +1400,10 @@ 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)
sinnykumari marked this conversation as resolved.
Show resolved Hide resolved
}

// Bootstrapping state is when we have the node annotations file
if state.bootstrapping {
targetOSImageURL := state.currentConfig.Spec.OSImageURL
Expand Down
14 changes: 14 additions & 0 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,20 @@ 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
17 changes: 0 additions & 17 deletions test/e2e-shared-tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/openshift/machine-config-operator/pkg/daemon/constants"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
kubeErrs "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"
Expand All @@ -21,22 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func assertKernelArgsEqual(t *testing.T, cs *framework.ClientSet, target corev1.Node, startKargs string, expectedKargs []string) {
t.Helper()

kargs := getKernelArgs(t, cs, target)

for _, karg := range expectedKargs {
assert.Contains(t, kargs, karg, "Missing karg %s", karg)
}

assert.Equal(t, kargs, startKargs)
}

func getKernelArgs(t *testing.T, cs *framework.ClientSet, target corev1.Node) string {
return helpers.ExecCmdOnNode(t, cs, target, "cat", "/proc/cmdline")
}

func waitForConfigDriftMonitorStart(t *testing.T, cs *framework.ClientSet, node corev1.Node) {
t.Helper()

Expand Down
11 changes: 1 addition & 10 deletions test/e2e-shared-tests/mcd_config_drift.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (c configDriftTest) getMachineConfig(t *testing.T) *mcfgv1.MachineConfig {
[]ign3types.SSHAuthorizedKey{},
[]string{},
false,
[]string{"foo=bar", "foo=baz"},
[]string{},
"",
"",
)
Expand All @@ -164,12 +164,6 @@ func (c configDriftTest) Teardown(t *testing.T) {

// Runs the Config Drift Test
func (c configDriftTest) Run(t *testing.T) {
// Get our kernel args for future verification
kargs := getKernelArgs(t, c.ClientSet, c.node)

// Check that we have our kernel args pre-test
assertKernelArgsEqual(t, c.ClientSet, c.node, kargs, c.mc.Spec.KernelArguments)

testCases := []struct {
name string
rebootExpected bool
Expand Down Expand Up @@ -238,9 +232,6 @@ func (c configDriftTest) Run(t *testing.T) {

testCase.testFunc(t)

// Ensure that we have our kernel args post-test
assertKernelArgsEqual(t, c.ClientSet, c.node, kargs, c.mc.Spec.KernelArguments)

// Verify our reboot expectations
if testCase.rebootExpected {
helpers.AssertNodeReboot(t, c.ClientSet, c.node, initialUptime)
Expand Down