From 35db607dfccd3c03b69f1a42c58cf58ec8259e37 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Tue, 29 Jan 2019 18:51:18 -0800 Subject: Add containerd shim v2 support. (#13) * Update vendors Signed-off-by: Lantao Liu * Add containerd shim v2 support. Signed-off-by: Lantao Liu * Add test and doc for containerd-shim-runsc-v1. Signed-off-by: Lantao Liu * Address comments. --- test/e2e/runtime-handler-shim-v2/install.sh | 21 +++++++++++++++++ test/e2e/runtime-handler-shim-v2/test.sh | 34 ++++++++++++++++++++++++++++ test/e2e/runtime-handler-shim-v2/validate.sh | 7 ++++++ test/e2e/runtime-handler/usage.sh | 4 ++-- test/e2e/shim-install.sh | 16 ++++++------- 5 files changed, 71 insertions(+), 11 deletions(-) create mode 100755 test/e2e/runtime-handler-shim-v2/install.sh create mode 100755 test/e2e/runtime-handler-shim-v2/test.sh create mode 100755 test/e2e/runtime-handler-shim-v2/validate.sh (limited to 'test') diff --git a/test/e2e/runtime-handler-shim-v2/install.sh b/test/e2e/runtime-handler-shim-v2/install.sh new file mode 100755 index 000000000..af6b5be1e --- /dev/null +++ b/test/e2e/runtime-handler-shim-v2/install.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# A sample script for installing and configuring the gvisor-containerd-shim to +# use the containerd runtime handler. + +set -ex + +{ # Step 1: Create containerd config.toml +cat < /tmp/containerd-cri.log & +} diff --git a/test/e2e/runtime-handler-shim-v2/test.sh b/test/e2e/runtime-handler-shim-v2/test.sh new file mode 100755 index 000000000..e33655ec1 --- /dev/null +++ b/test/e2e/runtime-handler-shim-v2/test.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Runs end-to-end tests for gvisor-containerd-shim to test the use of runtime +# handler. This should work on containerd 1.2+ + +# This is meant to be run in a VM as it makes a fairly invasive install of +# containerd. + +set -ex + +# Install containerd +. ./test/e2e/containerd-install.sh + +# Install gVisor +. ./test/e2e/runsc-install.sh + +# Install gvisor-containerd-shim +. ./test/e2e/shim-install.sh + +# Test installation/configuration +. ./test/e2e/runtime-handler-shim-v2/install.sh + +# Install crictl +. ./test/e2e/crictl-install.sh + +# Test usage (the same with runtime-handler) +. ./test/e2e/runtime-handler/usage.sh + +# Run a container in the sandbox +. ./test/e2e/run-container.sh + +# Validate the pod and container +. ./test/e2e/validate.sh +. ./test/e2e/runtime-handler-shim-v2/validate.sh diff --git a/test/e2e/runtime-handler-shim-v2/validate.sh b/test/e2e/runtime-handler-shim-v2/validate.sh new file mode 100755 index 000000000..b74a059ef --- /dev/null +++ b/test/e2e/runtime-handler-shim-v2/validate.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# A sample script to validating the running containerd-shim-runsc-v1. + +set -ex + +ps aux | grep [c]ontainerd-shim-runsc-v1 diff --git a/test/e2e/runtime-handler/usage.sh b/test/e2e/runtime-handler/usage.sh index 1f8a09757..350c720c2 100755 --- a/test/e2e/runtime-handler/usage.sh +++ b/test/e2e/runtime-handler/usage.sh @@ -1,7 +1,7 @@ #!/bin/bash -# A sample script for testing the gvisor-containerd-shim # using untrusted -# workload extension. +# A sample script for testing the gvisor-containerd-shim +# using runtime handler. set -ex diff --git a/test/e2e/shim-install.sh b/test/e2e/shim-install.sh index 93587ea50..c0252bdd4 100755 --- a/test/e2e/shim-install.sh +++ b/test/e2e/shim-install.sh @@ -5,23 +5,21 @@ set -ex # Build gvisor-containerd-shim -if [ "${INSTALL_LATEST}" === "1" ]; then -{ # Step 1: Download gvisor-containerd-shim +if [ "${INSTALL_LATEST}" == "1" ]; then +{ # Step 1(release): Install gvisor-containerd-shim LATEST_RELEASE=$(wget -qO - https://api.github.com/repos/google/gvisor-containerd-shim/releases | grep -oP '(?<="browser_download_url": ")https://[^"]*' | head -1) wget -O gvisor-containerd-shim chmod +x gvisor-containerd-shim +sudo mv gvisor-containerd-shim /usr/local/bin/gvisor-containerd-shim } else +{ # Step 1(dev): Build and install gvisor-containerd-shim and containerd-shim-runsc-v1 make - mv bin/gvisor-containerd-shim gvisor-containerd-shim-dev -fi - -{ # Step 2: Copy the binary to the desired directory -sudo mv gvisor-containerd-shim-* /usr/local/bin/gvisor-containerd-shim + sudo make install } +fi - -{ # Step 3: Create the gvisor-containerd-shim.yaml +{ # Step 2: Create the gvisor-containerd-shim.yaml cat <