Skip to content

Commit

Permalink
Also configure docker's containerd version via CLI flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Stockinger committed Dec 20, 2022
1 parent 7cb2878 commit 7c335e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/containerruntime/containerruntime.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package containerruntime

import (
"github.com/Masterminds/semver/v3"
"github.com/coreos/go-semver/semver"

"github.com/kubermatic/machine-controller/pkg/providerconfig/types"
)
Expand Down Expand Up @@ -130,6 +130,7 @@ func (cfg Config) Engine(kubeletVersion *semver.Version) Engine {
containerLogMaxFiles: cfg.ContainerLogMaxFiles,
containerLogMaxSize: cfg.ContainerLogMaxSize,
registryCredentials: cfg.RegistryCredentials,
containerdVersion: cfg.ContainerdVersion,
}

containerd := &Containerd{
Expand Down
15 changes: 10 additions & 5 deletions pkg/containerruntime/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
)

const (
LegacyDockerContainerdVersion = "1.4"
DefaultDockerContainerdVersion = "1.6"
LegacyDockerContainerdVersion = "1.4*"
DefaultDockerContainerdVersion = "1.6*"
DefaultDockerVersion = "20.10"
LegacyDockerVersion = "19.03"
)
Expand All @@ -39,6 +39,7 @@ type Docker struct {
containerLogMaxFiles string
containerLogMaxSize string
registryCredentials map[string]AuthConfig
containerdVersion string
}

type DockerCfgJSON struct {
Expand Down Expand Up @@ -88,6 +89,10 @@ func (eng *Docker) ScriptFor(os types.OperatingSystem) (string, error) {
ContainerdVersion: DefaultDockerContainerdVersion,
}

if eng.containerdVersion != "" {
args.ContainerdVersion = eng.containerdVersion
}

switch os {
case types.OperatingSystemAmazonLinux2:
args.ContainerdVersion = LegacyDockerContainerdVersion
Expand Down Expand Up @@ -126,7 +131,7 @@ EOF
yum install -y \
{{- if .ContainerdVersion }}
containerd-{{ .ContainerdVersion }}* \
containerd-{{ .ContainerdVersion }} \
{{- end }}
docker-{{ .DockerVersion }}* \
yum-plugin-versionlock
Expand All @@ -152,7 +157,7 @@ EOF
yum install -y \
{{- if .ContainerdVersion }}
docker-ce-cli-{{ .DockerVersion }}* \
containerd.io-{{ .ContainerdVersion }}* \
containerd.io-{{ .ContainerdVersion }} \
{{- end }}
docker-ce-{{ .DockerVersion }}* \
yum-plugin-versionlock
Expand All @@ -178,7 +183,7 @@ EOF
apt-get install --allow-downgrades -y \
{{- if .ContainerdVersion }}
containerd.io={{ .ContainerdVersion }}* \
containerd.io={{ .ContainerdVersion }} \
docker-ce-cli=5:{{ .DockerVersion }}* \
{{- end }}
docker-ce=5:{{ .DockerVersion }}*
Expand Down

0 comments on commit 7c335e2

Please sign in to comment.