summaryrefslogtreecommitdiff
path: root/hack
diff options
context:
space:
mode:
authorgy95 <1015105054@qq.com>2023-01-03 16:03:28 +0800
committergy95 <1015105054@qq.com>2023-01-13 16:30:28 +0800
commit27b2ac2ed7d2497d9b8b60e80b250458eec13717 (patch)
tree259d94670c03c0c88519a54a759e6caf50983467 /hack
parentMerge pull request #4427 from gy95/fuzz (diff)
downloadkubeedge-27b2ac2ed7d2497d9b8b60e80b250458eec13717.tar.gz
replace default runtime docker with containerd
Signed-off-by: gy95 <1015105054@qq.com>
Diffstat (limited to 'hack')
-rwxr-xr-xhack/lib/install.sh20
-rwxr-xr-xhack/local-up-kubeedge.sh26
2 files changed, 45 insertions, 1 deletions
diff --git a/hack/lib/install.sh b/hack/lib/install.sh
index 5b157514f..55252a337 100755
--- a/hack/lib/install.sh
+++ b/hack/lib/install.sh
@@ -78,6 +78,14 @@ function install_golangci-lint {
export PATH=$PATH:$GOPATH/bin
}
+verify_containerd_installed(){
+ # verify the containerd installed
+ command -v containerd >/dev/null || {
+ echo "must install the containerd first"
+ exit 1
+ }
+}
+
verify_docker_installed(){
# verify the docker installed
command -v docker >/dev/null || {
@@ -86,3 +94,15 @@ verify_docker_installed(){
}
}
+# install CNI plugins
+function install_cni_plugins() {
+ # install CNI plugins if not exist
+ if [ ! -f "/opt/cni/bin/loopback" ]; then
+ echo -e "install CNI plugins..."
+ mkdir -p /opt/cni/bin
+ wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz
+ tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.1.1.tgz
+ else
+ echo "CNI plugins already installed and no need to install"
+ fi
+}
diff --git a/hack/local-up-kubeedge.sh b/hack/local-up-kubeedge.sh
index c3d19b783..221231058 100755
--- a/hack/local-up-kubeedge.sh
+++ b/hack/local-up-kubeedge.sh
@@ -20,6 +20,7 @@ LOG_DIR=${LOG_DIR:-"/tmp"}
LOG_LEVEL=${LOG_LEVEL:-2}
TIMEOUT=${TIMEOUT:-60}s
PROTOCOL=${PROTOCOL:-"WebSocket"}
+CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"remote"}
if [[ "${CLUSTER_NAME}x" == "x" ]];then
CLUSTER_NAME="test"
@@ -31,7 +32,16 @@ function check_prerequisites {
kubeedge::golang::verify_golang_version
check_kubectl
check_kind
- verify_docker_installed
+ if [[ "${CONTAINER_RUNTIME}" = "docker" ]]; then
+ # if we will use docker as edgecore container runtime, we need to verify whether docker already installed
+ verify_docker_installed
+ elif [[ "${CONTAINER_RUNTIME}" = "remote" ]]; then
+ # we will use containerd as cri runtime, so need to verify whether containerd already installed
+ verify_containerd_installed
+ else
+ echo "not supported container runtime ${CONTAINER_RUNTIME}"
+ exit 1
+ fi
}
# spin up cluster with kind command
@@ -141,6 +151,14 @@ function start_edgecore {
sed -i '/websocket:/{n;s/true/false/;}' ${EDGE_CONFIGFILE}
fi
+ # if we will use docker as edgecore container runtime
+ # we need to change edgecore container runtime from default containerd to docker
+ if [[ "${CONTAINER_RUNTIME}" = "docker" ]]; then
+ sed -i 's|containerRuntime: .*|containerRuntime: docker|' ${EDGE_CONFIGFILE}
+ sed -i 's|remoteImageEndpoint: .*|remoteImageEndpoint: unix:///var/run/dockershim.sock|' ${EDGE_CONFIGFILE}
+ sed -i 's|remoteRuntimeEndpoint: .*|remoteRuntimeEndpoint: unix:///var/run/dockershim.sock|' ${EDGE_CONFIGFILE}
+ fi
+
token=`kubectl get secret -nkubeedge tokensecret -o=jsonpath='{.data.tokendata}' | base64 -d`
sed -i -e "s|token: .*|token: ${token}|g" \
@@ -227,6 +245,12 @@ build_edgecore
kind_up_cluster
+# install CNI plugins
+if [[ "${CONTAINER_RUNTIME}" = "remote" ]]; then
+ # we need to install CNI plugins only when we use remote(containerd) as edgecore container runtime
+ install_cni_plugins
+fi
+
export KUBECONFIG=$HOME/.kube/config
check_control_plane_ready