Skip to content

Commit

Permalink
Revert "PRODENG-2599 Restarting containerd on MCR upgrade (#458)" (#469)
Browse files Browse the repository at this point in the history
This reverts commit d0c144a.
  • Loading branch information
cranzy authored Apr 24, 2024
1 parent dcae7e6 commit ec5d95d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 52 deletions.
25 changes: 0 additions & 25 deletions pkg/configurer/linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import (
"regexp"
"strconv"
"strings"
"time"

"github.com/Mirantis/mcc/pkg/constant"
common "github.com/Mirantis/mcc/pkg/product/common/api"
"github.com/Mirantis/mcc/pkg/util/iputil"
escape "github.com/alessio/shellescape"
"github.com/avast/retry-go"
"github.com/k0sproject/rig/exec"
"github.com/k0sproject/rig/os"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -76,29 +74,6 @@ func (c LinuxConfigurer) RestartMCR(h os.Host) error {
return nil
}

// RestartContainerd restarts containerd.
func (c LinuxConfigurer) RestartContainerd(h os.Host) error {
if err := c.riglinux.RestartService(h, "containerd"); err != nil {
return fmt.Errorf("restart containerd service: %w", err)
}
err := retry.Do(
func() error {
if err := h.Exec(c.DockerCommandf("ps")); err != nil {
return fmt.Errorf("failed to run `docker ps` after containerd restart: %w", err)
}
return nil
},
retry.DelayType(retry.CombineDelay(retry.FixedDelay, retry.RandomDelay)),
retry.MaxJitter(time.Second*2),
retry.Delay(time.Second*3),
retry.Attempts(10),
)
if err != nil {
return fmt.Errorf("failed to restart containerd service: %w", err)
}
return nil
}

// ResolveInternalIP resolves internal ip from private interface.
func (c LinuxConfigurer) ResolveInternalIP(h os.Host, privateInterface, publicIP string) (string, error) {
output, err := h.ExecOutput(fmt.Sprintf("%s ip -o addr show dev %s scope global", SbinPath, privateInterface))
Expand Down
22 changes: 0 additions & 22 deletions pkg/configurer/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,6 @@ func (c WindowsConfigurer) RestartMCR(h os.Host) error {
return nil
}

// RestartContainerd restarts containerd service.
func (c WindowsConfigurer) RestartContainerd(h os.Host) error {
_ = h.Exec("net stop containerd")
_ = h.Exec("net start containerd")
err := retry.Do(
func() error {
if err := h.Exec(c.DockerCommandf("ps")); err != nil {
return fmt.Errorf("failed to run docker ps after restart: %w", err)
}
return nil
},
retry.DelayType(retry.CombineDelay(retry.FixedDelay, retry.RandomDelay)),
retry.MaxJitter(time.Second*2),
retry.Delay(time.Second*3),
retry.Attempts(10),
)
if err != nil {
return fmt.Errorf("failed to restart containerd service: %w", err)
}
return nil
}

// ResolveInternalIP resolves internal ip from private interface.
func (c WindowsConfigurer) ResolveInternalIP(h os.Host, privateInterface, publicIP string) (string, error) {
output, err := c.interfaceIP(h, privateInterface)
Expand Down
1 change: 0 additions & 1 deletion pkg/product/mke/api/configurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type HostConfigurer interface {
UninstallMCR(os.Host, string, common.MCRConfig) error
DockerCommandf(template string, args ...interface{}) string
RestartMCR(os.Host) error
RestartContainerd(os.Host) error
AuthenticateDocker(h os.Host, user, pass, repo string) error
LocalAddresses(os.Host) ([]string, error)
ValidateLocalhost(os.Host) error
Expand Down
4 changes: 0 additions & 4 deletions pkg/product/mke/phase/upgrade_mcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ func (p *UpgradeMCR) upgradeMCR(h *api.Host) error {
return fmt.Errorf("retry count exceeded: %w", err)
}

if err := h.Configurer.RestartContainerd(h); err != nil {
return fmt.Errorf("%s: failed to restart containerd: %w", h, err)
}

// TODO: This exercise is duplicated in InstallMCR, maybe
// combine into some kind of "EnsureVersion"
currentVersion, err := h.MCRVersion()
Expand Down

0 comments on commit ec5d95d

Please sign in to comment.