Update makefile and all integration test
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
@@ -133,8 +133,7 @@ fi
|
||||
# Install containerd
|
||||
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
|
||||
cd ${GOPATH}/src/${CONTAINERD_PKG}
|
||||
# Build no_cri version and run standalone cri-containerd.
|
||||
make BUILDTAGS="${BUILDTAGS} no_cri"
|
||||
make BUILDTAGS="${BUILDTAGS}"
|
||||
# containerd make install requires `go` to work. Explicitly
|
||||
# set PATH to make sure it can find `go` even with `sudo`.
|
||||
${sudo} sh -c "PATH=${PATH} make install -e DESTDIR=${CONTAINERD_DIR}"
|
||||
@@ -146,7 +145,7 @@ make crictl
|
||||
${sudo} make install-crictl -e BINDIR=${CRICTL_DIR} GOPATH=${GOPATH}
|
||||
${sudo} mkdir -p ${CRICTL_CONFIG_DIR}
|
||||
${sudo} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF
|
||||
runtime-endpoint: /var/run/cri-containerd.sock
|
||||
runtime-endpoint: /run/containerd/containerd.sock
|
||||
EOF'
|
||||
|
||||
# Clean the tmp GOPATH dir. Use sudo because runc build generates
|
||||
|
@@ -28,21 +28,31 @@ TARBALL=${TARBALL:-"cri-containerd.tar.gz"}
|
||||
# INCLUDE_CNI indicates whether to install CNI. By default don't
|
||||
# include CNI in release tarball.
|
||||
INCLUDE_CNI=${INCLUDE_CNI:-false}
|
||||
# CUSTOM_CONTAINERD indicates whether to install customized containerd
|
||||
# for CI test.
|
||||
CUSTOM_CONTAINERD=${CUSTOM_CONTAINERD:-false}
|
||||
|
||||
destdir=${BUILD_DIR}/release-stage
|
||||
|
||||
# Remove release-stage directory to avoid including old files.
|
||||
rm -rf ${destdir}
|
||||
|
||||
# Install dependencies into release stage.
|
||||
NOSUDO=true INSTALL_CNI=${INCLUDE_CNI} DESTDIR=${destdir} ./hack/install-deps.sh
|
||||
|
||||
# Install cri-containerd into release stage.
|
||||
make install -e DESTDIR=${destdir}
|
||||
# Install ctrcri into release stage.
|
||||
make install-ctrcri -e DESTDIR=${destdir}
|
||||
|
||||
if ${CUSTOM_CONTAINERD}; then
|
||||
make install-containerd -e DESTDIR=${destdir}
|
||||
fi
|
||||
|
||||
# Install systemd units into release stage.
|
||||
mkdir -p ${destdir}/etc/systemd/system
|
||||
cp ${ROOT}/contrib/systemd-units/* ${destdir}/etc/systemd/system/
|
||||
# Install cluster directory into release stage.
|
||||
mkdir -p ${destdir}/opt/cri-containerd
|
||||
cp -r ${ROOT}/cluster ${destdir}/opt/cri-containerd
|
||||
mkdir -p ${destdir}/opt/containerd
|
||||
cp -r ${ROOT}/cluster ${destdir}/opt/containerd
|
||||
|
||||
# Create release tar
|
||||
tarball=${BUILD_DIR}/${TARBALL}
|
||||
|
@@ -52,7 +52,7 @@ mkdir -p ${REPORT_DIR}
|
||||
test_setup ${REPORT_DIR}
|
||||
|
||||
# Run cri validation test
|
||||
sudo env PATH=${PATH} GOPATH=${GOPATH} ${CRITEST} --runtime-endpoint=${CRICONTAINERD_SOCK} --focus="${FOCUS}" --ginkgo-flags="--skip=\"${SKIP}\" --nodes=8" validation
|
||||
sudo env PATH=${PATH} GOPATH=${GOPATH} ${CRITEST} --runtime-endpoint=${CONTAINERD_SOCK} --focus="${FOCUS}" --ginkgo-flags="--skip=\"${SKIP}\" --nodes=8" validation
|
||||
test_exit_code=$?
|
||||
|
||||
test_teardown
|
||||
|
@@ -74,7 +74,7 @@ test_setup ${REPORT_DIR}
|
||||
|
||||
timeout "${TIMEOUT}" make test-e2e-node \
|
||||
RUNTIME=remote \
|
||||
CONTAINER_RUNTIME_ENDPOINT=unix://${CRICONTAINERD_SOCK} \
|
||||
CONTAINER_RUNTIME_ENDPOINT=unix://${CONTAINERD_SOCK} \
|
||||
ARTIFACTS=${REPORT_DIR} \
|
||||
TEST_ARGS='--kubelet-flags=--cgroups-per-qos=true \
|
||||
--kubelet-flags=--cgroup-root=/ \
|
||||
|
@@ -25,21 +25,15 @@ FOCUS=${FOCUS:-""}
|
||||
# REPORT_DIR is the the directory to store test logs.
|
||||
REPORT_DIR=${REPORT_DIR:-"/tmp/test-integration"}
|
||||
|
||||
CRICONTAINERD_ROOT="/var/lib/cri-containerd"
|
||||
if ! ${STANDALONE_CRI_CONTAINERD}; then
|
||||
CRICONTAINERD_ROOT="/var/lib/containerd/io.containerd.grpc.v1.cri"
|
||||
fi
|
||||
CRI_ROOT="/var/lib/containerd/io.containerd.grpc.v1.cri"
|
||||
|
||||
mkdir -p ${REPORT_DIR}
|
||||
test_setup ${REPORT_DIR}
|
||||
|
||||
# Run integration test.
|
||||
# Set STANDALONE_CRI_CONTAINERD so that integration test can see it.
|
||||
# Some integration test needs the env to skip itself.
|
||||
sudo ${ROOT}/_output/integration.test --test.run="${FOCUS}" --test.v \
|
||||
--standalone-cri-containerd=${STANDALONE_CRI_CONTAINERD} \
|
||||
--cri-containerd-endpoint=${CRICONTAINERD_SOCK} \
|
||||
--cri-containerd-root=${CRICONTAINERD_ROOT}
|
||||
--cri-endpoint=${CONTAINERD_SOCK} \
|
||||
--cri-root=${CRI_ROOT}
|
||||
|
||||
test_exit_code=$?
|
||||
|
||||
|
@@ -16,63 +16,36 @@
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/utils.sh
|
||||
|
||||
# CRI_CONTAINERD_FLAGS are the extra flags to use when start cri-containerd.
|
||||
CRI_CONTAINERD_FLAGS=${CRI_CONTAINERD_FLAGS:-""}
|
||||
# RESTART_WAIT_PERIOD is the period to wait before restarting cri-containerd/containerd.
|
||||
# RESTART_WAIT_PERIOD is the period to wait before restarting containerd.
|
||||
RESTART_WAIT_PERIOD=${RESTART_WAIT_PERIOD:-10}
|
||||
# STANDALONE_CRI_CONTAINERD indicates whether to run standalone cri-containerd.
|
||||
STANDALONE_CRI_CONTAINERD=${STANDALONE_CRI_CONTAINERD:-true}
|
||||
|
||||
CRICONTAINERD_SOCK=/var/run/cri-containerd.sock
|
||||
if ! ${STANDALONE_CRI_CONTAINERD}; then
|
||||
CRICONTAINERD_SOCK=/var/run/containerd/containerd.sock
|
||||
fi
|
||||
CONTAINERD_SOCK=/run/containerd/containerd.sock
|
||||
|
||||
cri_containerd_pid=
|
||||
containerd_pid=
|
||||
|
||||
# test_setup starts containerd and cri-containerd.
|
||||
# test_setup starts containerd.
|
||||
test_setup() {
|
||||
local report_dir=$1
|
||||
if [ ! -x ${ROOT}/_output/cri-containerd ]; then
|
||||
echo "cri-containerd is not built"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start containerd
|
||||
local containerd=$(command -v containerd)
|
||||
if [ ! -x "${containerd}" ]; then
|
||||
echo "containerd is not installed, please run hack/install-deps.sh"
|
||||
if [ ! -x ${ROOT}/_output/containerd ]; then
|
||||
echo "containerd is not built"
|
||||
exit 1
|
||||
fi
|
||||
sudo pkill -x cri-containerd
|
||||
sudo pkill -x containerd
|
||||
echo "using ${containerd}"
|
||||
echo "containerd version: $(${containerd} --version)"
|
||||
keepalive "sudo ${containerd}" ${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
|
||||
keepalive "sudo ${ROOT}/_output/containerd --log-level=debug" \
|
||||
${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log &
|
||||
containerd_pid=$!
|
||||
# Wait for containerd to be running by using the containerd client ctr to check the version
|
||||
# of the containerd server. Wait an increasing amount of time after each of five attempts
|
||||
readiness_check "sudo ctr version"
|
||||
|
||||
# Start cri-containerd
|
||||
if ${STANDALONE_CRI_CONTAINERD}; then
|
||||
keepalive "sudo ${ROOT}/_output/cri-containerd --log-level=debug ${CRI_CONTAINERD_FLAGS}" \
|
||||
${RESTART_WAIT_PERIOD} &> ${report_dir}/cri-containerd.log &
|
||||
cri_containerd_pid=$!
|
||||
fi
|
||||
readiness_check "sudo ${GOPATH}/bin/crictl --runtime-endpoint=${CRICONTAINERD_SOCK} info"
|
||||
readiness_check "sudo ${GOPATH}/bin/crictl --runtime-endpoint=${CONTAINERD_SOCK} info"
|
||||
}
|
||||
|
||||
# test_teardown kills containerd and cri-containerd.
|
||||
# test_teardown kills containerd.
|
||||
test_teardown() {
|
||||
if [ -n "${containerd_pid}" ]; then
|
||||
kill ${containerd_pid}
|
||||
fi
|
||||
if [ -n "${cri_containerd_pid}" ]; then
|
||||
kill ${cri_containerd_pid}
|
||||
fi
|
||||
sudo pkill -x cri-containerd
|
||||
sudo pkill -x containerd
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user