From 7f531263e6e41195278f205ad01274487cc1c1e0 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 20 Dec 2017 15:13:52 -0600 Subject: Add default CNI configuration podman needs a pair of configuration files to set up its default network configuration: a bridge and loopback file. Signed-off-by: baude Closes: #161 Approved by: baude --- test/helpers.bash | 62 +++++++------------------------------------------------ 1 file changed, 7 insertions(+), 55 deletions(-) (limited to 'test/helpers.bash') diff --git a/test/helpers.bash b/test/helpers.bash index 30f66f283..2ac203027 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -85,7 +85,7 @@ HOOKS_OPTS="--hooks-dir-path=$HOOKSDIR" MOUNT_PATH="$TESTDIR/secrets" mkdir ${MOUNT_PATH} MOUNT_FILE="${MOUNT_PATH}/test.txt" -touch ${MOUNT_FILE} +touch ${MOUNT_FILE}} echo "Testing secrets mounts!" > ${MOUNT_FILE} DEFAULT_MOUNTS_OPTS="--default-mounts=${MOUNT_PATH}:/container/path1" @@ -104,11 +104,16 @@ if [ -e /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then filelabel=$(awk -F'"' '/^file.*=.*/ {print $2}' /etc/selinux/${SELINUXTYPE}/contexts/lxc_contexts) chcon -R ${filelabel} $TESTDIR fi -LIBPOD_CNI_CONFIG="$TESTDIR/cni/net.d/" + +LIBPOD_CNI_CONFIG="$TESTDIR/etc/cni/net.d/" LIBPOD_CNI_PLUGIN=${LIBPOD_CNI_PLUGIN:-/opt/cni/bin/} POD_CIDR="10.88.0.0/16" POD_CIDR_MASK="10.88.*.*" +# Make sure the cni config dirs are created and populate them with the default configs +mkdir -p ${LIBPOD_CNI_CONFIG} +cp ${CRIO_ROOT}/cni/* ${LIBPOD_CNI_CONFIG} + PODMAN_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTIONS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY} --conmon ${CONMON_BINARY} --cni-config-dir ${LIBPOD_CNI_CONFIG}" cp "$CONMON_BINARY" "$TESTDIR/conmon" @@ -193,59 +198,6 @@ function is_apparmor_enabled() { echo 0 } -function prepare_network_conf() { - mkdir -p $LIBPOD_CNI_CONFIG - cat >$LIBPOD_CNI_CONFIG/10-crio.conf <<-EOF -{ - "cniVersion": "0.2.0", - "name": "crionet", - "type": "bridge", - "bridge": "cni0", - "isGateway": true, - "ipMasq": true, - "ipam": { - "type": "host-local", - "subnet": "10.20.40.0/24", - "routes": [ - { "dst": "0.0.0.0/0" } - ] - } -} -EOF - - cat >$LIBPOD_CNI_CONFIG/99-loopback.conf <<-EOF -{ - "cniVersion": "0.2.0", - "type": "loopback" -} -EOF - - echo 0 -} - -function prepare_plugin_test_args_network_conf() { - mkdir -p $LIBPOD_CNI_CONFIG - cat >$LIBPOD_CNI_CONFIG/10-plugin-test-args.conf <<-EOF -{ - "cniVersion": "0.2.0", - "name": "crionet_test_args", - "type": "bridge-custom", - "bridge": "cni0", - "isGateway": true, - "ipMasq": true, - "ipam": { - "type": "host-local", - "subnet": "10.20.40.0/24", - "routes": [ - { "dst": "0.0.0.0/0" } - ] - } -} -EOF - - echo 0 -} - function check_pod_cidr() { run crioctl ctr execsync --id $1 ip addr show dev eth0 scope global 2>&1 echo "$output" -- cgit v1.2.3-54-g00ecf