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

Changes to OS and package updates as a follow-up on the discussion in PR #169 #209

Merged
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: 2 additions & 2 deletions agent/installer/installer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ var _ = Describe("Byohost Installer Tests", func() {
i := NewPreviewInstaller(os, &ob)
err := i.Install(k8s, testTag)
Expect(err).ShouldNot((HaveOccurred()))
Expect(ob.LogCalledCnt).Should(Equal(24))
Expect(ob.LogCalledCnt).Should(Equal(22))
}

{
ob := algo.OutputBuilderCounter{}
i := NewPreviewInstaller(os, &ob)
err := i.Uninstall(k8s, testTag)
Expect(err).ShouldNot((HaveOccurred()))
Expect(ob.LogCalledCnt).Should(Equal(24))
Expect(ob.LogCalledCnt).Should(Equal(22))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion agent/installer/internal/algo/algo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var _ = Describe("Installer Algo Tests", func() {
)

const (
stepsNum = 24
stepsNum = 22
)

BeforeEach(func() {
Expand Down
7 changes: 5 additions & 2 deletions agent/installer/internal/algo/apt_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ func NewAptStepEx(k *BaseK8sInstaller, aptPkg string, optional bool) Step {
if optional {
condCmd = fmt.Sprintf("if [ -f %s ]; then %%s; fi", pkgAbsolutePath)
}

doCmd := fmt.Sprintf("dpkg --install '%s'", pkgAbsolutePath)
// apt-mark hold will prevent the package from being automatically installed, upgraded or removed.
// This is done to prevent unexpected upgrades of the external package in order to ensure that
// the working environment is stable. If needed the package can be manually upgraded.
doCmd := fmt.Sprintf("dpkg --install '%s' && apt-mark hold %s", pkgAbsolutePath, pkgName)
// When uninstalling the package the hold is removed automatically.
undoCmd := fmt.Sprintf("dpkg --purge %s", pkgName)

return &ShellStep{
Expand Down
2 changes: 0 additions & 2 deletions agent/installer/internal/algo/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type K8sStepProvider interface {
// os state related steps
swapStep(*BaseK8sInstaller) Step
firewallStep(*BaseK8sInstaller) Step
unattendedUpdStep(*BaseK8sInstaller) Step
kernelModsLoadStep(*BaseK8sInstaller) Step

// packages related steps
Expand Down Expand Up @@ -132,7 +131,6 @@ func (b *BaseK8sInstaller) getSteps(bki *BaseK8sInstaller) []Step {
var steps = []Step{
b.swapStep(bki),
b.firewallStep(bki),
b.unattendedUpdStep(bki),
b.kernelModsLoadStep(bki),
b.osWideCfgUpdateStep(bki),
b.criToolsStep(bki),
Expand Down
4 changes: 0 additions & 4 deletions agent/installer/internal/algo/mock_ubuntu_with_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ func (u *MockUbuntuWithError) kernelModsLoadStep(bki *BaseK8sInstaller) Step {
return u.getEmptyStep("KERNEL MODULES", bki)
}

func (u *MockUbuntuWithError) unattendedUpdStep(bki *BaseK8sInstaller) Step {
return u.getEmptyStep("AUTO OS UPGRADES", bki)
}

func (u *MockUbuntuWithError) osWideCfgUpdateStep(bki *BaseK8sInstaller) Step {
return u.getEmptyStep("OS CONFIGURATION", bki)
}
Expand Down
8 changes: 0 additions & 8 deletions agent/installer/internal/algo/ubuntu20_4K8s1_22.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ func (u *Ubuntu20_4K8s1_22) kernelModsLoadStep(bki *BaseK8sInstaller) Step {
UndoCmd: "modprobe -r overlay && modprobe -r br_netfilter"}
}

func (u *Ubuntu20_4K8s1_22) unattendedUpdStep(bki *BaseK8sInstaller) Step {
return &ShellStep{
BaseK8sInstaller: bki,
Desc: "AUTO OS UPGRADES",
DoCmd: "sed -ri 's/1/0/g' /etc/apt/apt.conf.d/20auto-upgrades",
UndoCmd: "sed -ri 's/0/1/g' /etc/apt/apt.conf.d/20auto-upgrades"}
}

func (u *Ubuntu20_4K8s1_22) osWideCfgUpdateStep(bki *BaseK8sInstaller) Step {
confAbsolutePath := filepath.Join(bki.BundlePath, "conf.tar")

Expand Down