Add HyperV config in tests

This change adds two new environment variables to cri-integration tests
on Windows that enable Hyper-V isolation.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2022-06-06 17:37:02 +03:00 committed by Nashwan Azhari
parent d878d7dda8
commit 9494f0b806

View File

@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# USE_HYPERV configures containerd to spawn Hyper-V isolated containers
# when running on Windows.
USE_HYPERV=${USE_HYPERV:-0}
IS_WINDOWS=0
if [ -v "OS" ] && [ "${OS}" == "Windows_NT" ]; then
IS_WINDOWS=1
@ -105,6 +109,24 @@ EOF
EOF
fi
if [ ${IS_WINDOWS} -eq 1 -a ${USE_HYPERV} -eq 1 ];then
cat >> ${CONTAINERD_CONFIG_FILE} << EOF
version = 2
[plugins]
[plugins."io.containerd.grpc.v1.cri".containerd]
default_runtime_name = "runhcs-wcow-hyperv"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runhcs-wcow-hyperv]
runtime_type = "io.containerd.runhcs.v1"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runhcs-wcow-hyperv.options]
Debug = true
DebugType = 2
SandboxPlatform = "windows/amd64"
SandboxIsolation = 1
EOF
fi
# CONTAINERD_TEST_SUFFIX is the suffix appended to the root/state directory used
# by test containerd.
CONTAINERD_TEST_SUFFIX=${CONTAINERD_TEST_SUFFIX:-"-test"}