Skip to content

Commit cb97532

Browse files
author
Lis
authored
feat(platform): support containerd as runtime (#1390) (#1470)
1 parent 94e2547 commit cb97532

File tree

31 files changed

+896
-435
lines changed

31 files changed

+896
-435
lines changed

api/openapi/zz_generated.openapi.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/platform/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ const (
231231
GPUVirtual GPUType = "Virtual"
232232
)
233233

234+
type ContainerRuntimeType = string
235+
236+
const (
237+
Containerd ContainerRuntimeType = "containerd"
238+
Docker ContainerRuntimeType = "docker"
239+
)
240+
234241
// ClusterPhase defines the phase of cluster constructor.
235242
type ClusterPhase string
236243

@@ -388,6 +395,8 @@ type ClusterFeature struct {
388395
// +optional
389396
EnableCilium bool
390397
// +optional
398+
ContainerRuntime ContainerRuntimeType
399+
// +optional
391400
IPv6DualStack bool
392401
// Upgrade control upgrade process.
393402
// +optional

api/platform/v1/generated.pb.go

Lines changed: 427 additions & 385 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/platform/v1/generated.proto

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/platform/v1/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ const (
237237
GPUVirtual GPUType = "Virtual"
238238
)
239239

240+
type ContainerRuntimeType = string
241+
242+
const (
243+
Containerd ContainerRuntimeType = "containerd"
244+
Docker ContainerRuntimeType = "docker"
245+
)
246+
240247
// ClusterPhase defines the phase of cluster constructor.
241248
type ClusterPhase string
242249

@@ -395,6 +402,8 @@ type ClusterFeature struct {
395402
IPv6DualStack bool `json:"ipv6DualStack,omitempty" protobuf:"bytes,13,opt,name=ipv6DualStack"`
396403
// +optional
397404
EnableCilium bool `json:"enableCilium,omitempty" protobuf:"bytes,14,opt,name=enableCilium"`
405+
// +optional
406+
ContainerRuntime ContainerRuntimeType `json:"containerRuntime,omitempty" protobuf:"bytes,15,opt,name=containerRuntime"`
398407
// Upgrade control upgrade process.
399408
// +optional
400409
Upgrade Upgrade `json:"upgrade,omitempty" protobuf:"bytes,22,opt,name=upgrade"`

api/platform/v1/zz_generated.conversion.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/docker/tools/provider-res/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@ COPY linux-arm64/cni-*.tar.gz res/linux-arm64/
2626
COPY linux-amd64/conntrack-tools-*.tar.gz res/linux-amd64/
2727
COPY linux-arm64/conntrack-tools-*.tar.gz res/linux-arm64/
2828

29+
COPY linux-amd64/nerdctl-*.tar.gz res/linux-amd64/
30+
COPY linux-arm64/nerdctl-*.tar.gz res/linux-arm64/
31+
2932
COPY linux-amd64/docker-*.tar.gz res/linux-amd64/
3033
COPY linux-arm64/docker-*.tar.gz res/linux-arm64/
3134

35+
COPY linux-amd64/containerd-*.tar.gz res/linux-amd64/
36+
COPY linux-arm64/containerd-*.tar.gz res/linux-arm64/
37+
3238
COPY linux-amd64/kubernetes-*.tar.gz res/linux-amd64/
3339
COPY linux-arm64/kubernetes-*.tar.gz res/linux-arm64/
3440

3541
COPY linux-amd64/NVIDIA-*.tar.gz res/linux-amd64/
3642

3743
COPY linux-amd64/nvidia-container-*.tar.gz res/linux-amd64/
3844

45+
COPY containerd conf/containerd
46+
COPY kubeadm conf/kubeadm
47+
3948
ENTRYPOINT ["sh"]

build/docker/tools/provider-res/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations under the License.
1616

1717
IMAGE = provider-res
18-
VERSION = v1.20.4-1
18+
VERSION = v1.20.4-2
1919
REGISTRY_PREFIX ?= tkestack
2020

2121
COMMON_SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
@@ -34,6 +34,8 @@ include $(ROOT_DIR)/build/lib/docker-buildx.mk
3434
.PHONY: per.build
3535
per.build: download
3636
@cp "$(ROOT_DIR)/build/docker/tools/$(IMAGE)/Dockerfile" "$(WORK_DIR)/Dockerfile"
37+
@cp -r "$(ROOT_DIR)/pkg/platform/provider/baremetal/conf/containerd" "$(WORK_DIR)/containerd"
38+
@cp -r "$(ROOT_DIR)/pkg/platform/provider/baremetal/conf/kubeadm" "$(WORK_DIR)/kubeadm"
3739

3840
.PHONY: download
3941
download:
@@ -64,7 +66,7 @@ manifest.multiarch: per.build
6466
#@rm -rf "$(WORK_DIR)"
6567
@echo "===========> Pushing manifest $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) and then remove the local manifest list"
6668
REGISTRY_PREFIX=$(REGISTRY_PREFIX) PLATFROMS="$(PLATFORMS)" IMAGE=$(IMAGE) VERSION=$(VERSION) \
67-
DOCKER_CLI_EXPERIMENTAL=enabled $(ROOT_DIR)/build/lib/create-manifest.sh
69+
DOCKER_CLI_EXPERIMENTAL=enabled $(ROOT_DIR)/build/lib/create-manifest.sh
6870

6971
## help: Show this help info.
7072
.PHONY: help

build/docker/tools/provider-res/download.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,41 @@ function download::docker() {
5656
done
5757
}
5858

59+
function download::containerd() {
60+
if [ "${arch}" == "amd64" ]; then
61+
containerd_arch=amd64
62+
for version in ${CONTAINERD_VERSIONS}; do
63+
wget -c "https://github.com/containerd/containerd/releases/download/v${version}/cri-containerd-cni-${version}-linux-${containerd_arch}.tar.gz" \
64+
-O "containerd-${platform}-${version}.tar.gz"
65+
done
66+
elif [ "${arch}" == "arm64" ]; then
67+
containerd_arch=arm64
68+
for version in ${CONTAINERD_VERSIONS}; do
69+
wget -c "https://tke-release-1251707795.cos.ap-guangzhou.myqcloud.com/cri-containerd-cni-${version}-linux-${containerd_arch}.tar.gz" \
70+
-O "containerd-${platform}-${version}.tar.gz"
71+
done
72+
else
73+
echo "[ERROR] Fail to get containerd ${arch} on ${platform} platform."
74+
exit 255
75+
fi
76+
}
77+
78+
function download::nerdctl() {
79+
if [ "${arch}" == "amd64" ]; then
80+
nerdctl_arch=x86_64
81+
elif [ "${arch}" == "arm64" ]; then
82+
nerdctl_arch=arm64
83+
else
84+
echo "[ERROR] Fail to get nerdctl ${arch} on ${platform} platform."
85+
exit 255
86+
fi
87+
88+
for version in ${NERDCTL_VERSIONS}; do
89+
wget -c "https://github.com/containerd/nerdctl/releases/download/v${version}/nerdctl-${version}-linux-${arch}.tar.gz" \
90+
-O "nerdctl-${platform}-${version}.tar.gz"
91+
done
92+
}
93+
5994
function download::kubernetes() {
6095
for version in ${K8S_VERSIONS}; do
6196
if [[ "${version}" =~ "tke" ]]; then
@@ -115,6 +150,8 @@ for os in ${OSS}; do
115150

116151
download::cni_plugins
117152
download::docker
153+
download::containerd
154+
download::nerdctl
118155
download::kubernetes
119156
download::nvidia_driver
120157
download::nvidia_container_runtime

build/docker/tools/tke-installer/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -o pipefail
2323
REGISTRY_PREFIX=${REGISTRY_PREFIX:-tkestack}
2424
BUILDER=${BUILDER:-default}
2525
VERSION=${VERSION:-$(git describe --dirty --always --tags | sed 's/-/./g')}
26-
PROVIDER_RES_VERSION=v1.20.4-1
26+
PROVIDER_RES_VERSION=v1.20.4-2
2727
K8S_VERSION=${PROVIDER_RES_VERSION%-*}
2828
DOCKER_VERSION=19.03.14
2929
OSS=(linux)

0 commit comments

Comments
 (0)