Skip to content

Commit b0d51a0

Browse files
authored
Update Docker to 19.03.12 for Ubuntu, CentOS, RHEL (#815)
* Update Docker to 19.03.12 for Ubuntu, CentOS, RHEL * Update test fixtures * Fix import order
1 parent aea6ef8 commit b0d51a0

24 files changed

+78
-23
lines changed

pkg/userdata/centos/provider.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
4848
return "", fmt.Errorf("invalid kubelet version: '%v'", err)
4949
}
5050

51+
dockerVersion, err := userdatahelper.DockerVersionYum(kubeletVersion)
52+
if err != nil {
53+
return "", fmt.Errorf("invalid docker version: %v", err)
54+
}
55+
5156
pconfig, err := providerconfigtypes.GetConfig(req.MachineSpec.ProviderSpec)
5257
if err != nil {
5358
return "", fmt.Errorf("failed to get provider config: %v", err)
@@ -86,6 +91,7 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
8691
ProviderSpec *providerconfigtypes.Config
8792
OSConfig *Config
8893
KubeletVersion string
94+
DockerVersion string
8995
ServerAddr string
9096
Kubeconfig string
9197
KubernetesCACert string
@@ -95,6 +101,7 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
95101
ProviderSpec: pconfig,
96102
OSConfig: centosConfig,
97103
KubeletVersion: kubeletVersion.String(),
104+
DockerVersion: dockerVersion,
98105
ServerAddr: serverAddr,
99106
Kubeconfig: kubeconfigString,
100107
KubernetesCACert: kubernetesCACert,
@@ -193,7 +200,7 @@ write_files:
193200
{{- /* We need to explicitly specify docker-ce and docker-ce-cli to the same version.
194201
See: https://github.com/docker/cli/issues/2533 */}}
195202
196-
DOCKER_VERSION='18.09.9-3.el7'
203+
DOCKER_VERSION='{{ .DockerVersion }}'
197204
yum install -y docker-ce-${DOCKER_VERSION} \
198205
docker-ce-cli-${DOCKER_VERSION} \
199206
ebtables \

pkg/userdata/centos/testdata/kubelet-v1.17-aws-external.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ write_files:
7171
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
7272
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
7373
74-
DOCKER_VERSION='18.09.9-3.el7'
74+
DOCKER_VERSION='19.03.12-3.el7'
7575
yum install -y docker-ce-${DOCKER_VERSION} \
7676
docker-ce-cli-${DOCKER_VERSION} \
7777
ebtables \

pkg/userdata/centos/testdata/kubelet-v1.17-aws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ write_files:
7171
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
7272
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
7373
74-
DOCKER_VERSION='18.09.9-3.el7'
74+
DOCKER_VERSION='19.03.12-3.el7'
7575
yum install -y docker-ce-${DOCKER_VERSION} \
7676
docker-ce-cli-${DOCKER_VERSION} \
7777
ebtables \

pkg/userdata/centos/testdata/kubelet-v1.17-vsphere-mirrors.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ write_files:
8383
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
8484
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
8585
86-
DOCKER_VERSION='18.09.9-3.el7'
86+
DOCKER_VERSION='19.03.12-3.el7'
8787
yum install -y docker-ce-${DOCKER_VERSION} \
8888
docker-ce-cli-${DOCKER_VERSION} \
8989
ebtables \

pkg/userdata/centos/testdata/kubelet-v1.17-vsphere-proxy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ write_files:
8383
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
8484
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
8585
86-
DOCKER_VERSION='18.09.9-3.el7'
86+
DOCKER_VERSION='19.03.12-3.el7'
8787
yum install -y docker-ce-${DOCKER_VERSION} \
8888
docker-ce-cli-${DOCKER_VERSION} \
8989
ebtables \

pkg/userdata/centos/testdata/kubelet-v1.17-vsphere.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ write_files:
7575
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
7676
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
7777
78-
DOCKER_VERSION='18.09.9-3.el7'
78+
DOCKER_VERSION='19.03.12-3.el7'
7979
yum install -y docker-ce-${DOCKER_VERSION} \
8080
docker-ce-cli-${DOCKER_VERSION} \
8181
ebtables \

pkg/userdata/helper/helper.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"fmt"
2222
"strings"
2323

24+
"github.com/Masterminds/semver"
25+
2426
"k8s.io/client-go/tools/clientcmd"
2527
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
2628
)
@@ -132,6 +134,38 @@ func DockerConfig(insecureRegistries, registryMirrors []string) (string, error)
132134
return string(b), err
133135
}
134136

137+
// DockerVersionApt returns Docker version to be installed on instances using apt (Ubuntu).
138+
func DockerVersionApt(kubernetesVersion *semver.Version) (string, error) {
139+
if kubernetesVersion == nil {
140+
return "", fmt.Errorf("invalid kubernetes version")
141+
}
142+
143+
lessThen117, _ := semver.NewConstraint("< 1.17")
144+
145+
if lessThen117.Check(kubernetesVersion) {
146+
return "5:18.09.9~3-0~ubuntu-bionic", nil
147+
}
148+
149+
// return default
150+
return "5:19.03.12~3-0~ubuntu-bionic", nil
151+
}
152+
153+
// DockerVersionYum returns Docker version to be installed on instances using yum (CentOS/RHEL).
154+
func DockerVersionYum(kubernetesVersion *semver.Version) (string, error) {
155+
if kubernetesVersion == nil {
156+
return "", fmt.Errorf("invalid kubernetes version")
157+
}
158+
159+
lessThen117, _ := semver.NewConstraint("< 1.17")
160+
161+
if lessThen117.Check(kubernetesVersion) {
162+
return "18.09.9-3.el7", nil
163+
}
164+
165+
// return default
166+
return "19.03.12-3.el7", nil
167+
}
168+
135169
func ProxyEnvironment(proxy, noProxy string) string {
136170
return fmt.Sprintf(`HTTP_PROXY=%s
137171
http_proxy=%s

pkg/userdata/rhel/provider.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
4848
return "", fmt.Errorf("invalid kubelet version: %v", err)
4949
}
5050

51+
dockerVersion, err := userdatahelper.DockerVersionYum(kubeletVersion)
52+
if err != nil {
53+
return "", fmt.Errorf("invalid docker version: %v", err)
54+
}
55+
5156
pconfig, err := providerconfigtypes.GetConfig(req.MachineSpec.ProviderSpec)
5257
if err != nil {
5358
return "", fmt.Errorf("failed to get provider config: %v", err)
@@ -86,6 +91,7 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
8691
ProviderSpec *providerconfigtypes.Config
8792
OSConfig *Config
8893
KubeletVersion string
94+
DockerVersion string
8995
ServerAddr string
9096
Kubeconfig string
9197
KubernetesCACert string
@@ -95,6 +101,7 @@ func (p Provider) UserData(req plugin.UserDataRequest) (string, error) {
95101
ProviderSpec: pconfig,
96102
OSConfig: rhelConfig,
97103
KubeletVersion: kubeletVersion.String(),
104+
DockerVersion: dockerVersion,
98105
ServerAddr: serverAddr,
99106
Kubeconfig: kubeconfigString,
100107
KubernetesCACert: kubernetesCACert,
@@ -190,7 +197,7 @@ write_files:
190197
More info at: https://bugzilla.redhat.com/show_bug.cgi?id=1756473 */}}
191198
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
192199
193-
DOCKER_VERSION='18.09.9-3.el7'
200+
DOCKER_VERSION='{{ .DockerVersion }}'
194201
yum install -y docker-ce-${DOCKER_VERSION} \
195202
docker-ce-cli-${DOCKER_VERSION} \
196203
ebtables \

pkg/userdata/rhel/testdata/kubelet-v1.17-aws-external.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ write_files:
7171
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
7272
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
7373
74-
DOCKER_VERSION='18.09.9-3.el7'
74+
DOCKER_VERSION='19.03.12-3.el7'
7575
yum install -y docker-ce-${DOCKER_VERSION} \
7676
docker-ce-cli-${DOCKER_VERSION} \
7777
ebtables \

pkg/userdata/rhel/testdata/kubelet-v1.17-aws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ write_files:
7171
yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
7272
yum-config-manager --save --setopt=docker-ce-stable.module_hotfixes=true
7373
74-
DOCKER_VERSION='18.09.9-3.el7'
74+
DOCKER_VERSION='19.03.12-3.el7'
7575
yum install -y docker-ce-${DOCKER_VERSION} \
7676
docker-ce-cli-${DOCKER_VERSION} \
7777
ebtables \

0 commit comments

Comments
 (0)