Add hostport support

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2017-08-23 01:25:00 +00:00
parent 8f898cb3b8
commit f6d99abcf4
7 changed files with 124 additions and 26 deletions

View File

@@ -32,7 +32,7 @@ ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
BUILD_IMAGE=golang:1.8
RUNC_PKG=github.com/opencontainers/runc
CNI_PKG=github.com/containernetworking/cni
CNI_PKG=github.com/containernetworking/plugins
CNI_DIR=/opt/cni
CNI_CONFIG_DIR=/etc/cni/net.d
CONTAINERD_PKG=github.com/containerd/containerd
@@ -51,31 +51,33 @@ go get -d ${CNI_PKG}/...
cd ${GOPATH}/src/${CNI_PKG}
git fetch --all
git checkout ${CNI_VERSION}
./build
./build.sh
sudo mkdir -p ${CNI_DIR}
sudo cp -r ./bin ${CNI_DIR}
sudo mkdir -p ${CNI_CONFIG_DIR}
sudo bash -c 'cat >'${CNI_CONFIG_DIR}'/10-containerd-bridge.conf <<EOF
sudo bash -c 'cat >'${CNI_CONFIG_DIR}'/10-containerd-net.conflist <<EOF
{
"cniVersion": "0.2.0",
"name": "containerd-bridge",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"cniVersion": "0.3.1",
"name": "containerd-net",
"plugins": [
{
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
{ "dst": "0.0.0.0/0" }
]
}
},
{
"type": "portmap",
"capabilities": {"portMappings": true}
}
}
EOF'
sudo bash -c 'cat >'${CNI_CONFIG_DIR}'/99-loopback.conf <<EOF
{
"cniVersion": "0.2.0",
"type": "loopback"
]
}
EOF'

View File

@@ -21,7 +21,7 @@ source $(dirname "${BASH_SOURCE[0]}")/test-utils.sh
# FOCUS focuses the test to run.
FOCUS=${FOCUS:-}
# SKIP skips the test to skip.
SKIP=${SKIP:-"attach|RunAsUser|host port"}
SKIP=${SKIP:-"attach|RunAsUser"}
REPORT_DIR=${REPORT_DIR:-"/tmp/test-cri"}
if [[ -z "${GOPATH}" ]]; then