Compare commits

..

5 Commits

Author SHA1 Message Date
b634ff6bcd Merge pull request #206 from jonboulle/steveeJ-v0.2
v0.2.x: cherry-pick masquerading clean-up fixes
2016-05-12 11:10:13 +02:00
8c51016e19 plugins/{ptp,bridge}: teardown first
This will allow the IPAM allocations to be cleared in case the
interfaces and iptables rules are non-existent.
2016-05-12 11:01:08 +02:00
320f810cfb plugins/bridge: clean masquerading rules
In the Add command we set up masquerading rules that didn't have a
corresponding clean-up code in Del.

Add the clean-up code.
2016-05-11 18:15:37 +02:00
19bb4a15bb release script: don't run the tests
For two reasons:

1. They're not functional within rkt
2. They rebuild the binaries dynamically
2016-05-06 17:50:01 +02:00
a721ce6bbf build/release: link all release binaries statically 2016-04-28 22:40:59 +02:00
5 changed files with 30 additions and 43 deletions

9
build
View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -xe
ORG_PATH="github.com/appc"
REPO_PATH="${ORG_PATH}/cni"
@ -14,18 +14,17 @@ export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
echo "Building API"
go build ${REPO_PATH}/libcni
go build "$@" ${REPO_PATH}/libcni
echo "Building reference CLI"
go install ${REPO_PATH}/cnitool
go install "$@" ${REPO_PATH}/cnitool
echo "Building plugins"
PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/*"
for d in $PLUGINS; do
if [ -d $d ]; then
plugin=$(basename $d)
echo " " $plugin
go install ${REPO_PATH}/$d
go install "$@" ${REPO_PATH}/$d
fi
done

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -xe
ORG_PATH="github.com/appc"
REPO_PATH="${ORG_PATH}/cni"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GO15VENDOREXPERIMENT=1
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
export CGO_ENABLED=0
echo "Building API"
go build ${REPO_PATH}/libcni
echo "Building reference CLI"
go install --ldflags '-extldflags "-static"' ${REPO_PATH}/cnitool
echo "Building plugins"
PLUGINS="plugins/meta/* plugins/main/* plugins/ipam/*"
for d in $PLUGINS; do
if [ -d $d ]; then
plugin=$(basename $d)
echo " " $plugin
go install ${REPO_PATH}/$d
fi
done

View File

@ -238,14 +238,29 @@ func cmdDel(args *skel.CmdArgs) error {
return err
}
err = ipam.ExecDel(n.IPAM.Type, args.StdinData)
if err := ipam.ExecDel(n.IPAM.Type, args.StdinData); err != nil {
return err
}
var ipn *net.IPNet
err = ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
var err error
ipn, err = ip.DelLinkByNameAddr(args.IfName, netlink.FAMILY_V4)
return err
})
if err != nil {
return err
}
return ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
return ip.DelLinkByName(args.IfName)
})
if n.IPMasq {
chain := utils.FormatChainName(n.Name, args.ContainerID)
comment := utils.FormatComment(n.Name, args.ContainerID)
if err = ip.TeardownIPMasq(ipn, chain, comment); err != nil {
return err
}
}
return nil
}
func main() {

View File

@ -195,6 +195,10 @@ func cmdDel(args *skel.CmdArgs) error {
return fmt.Errorf("failed to load netconf: %v", err)
}
if err := ipam.ExecDel(conf.IPAM.Type, args.StdinData); err != nil {
return err
}
var ipn *net.IPNet
err := ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
var err error
@ -213,7 +217,7 @@ func cmdDel(args *skel.CmdArgs) error {
}
}
return ipam.ExecDel(conf.IPAM.Type, args.StdinData)
return nil
}
func main() {

View File

@ -7,6 +7,7 @@ FEDORA_INSTALL="dnf install -y golang tar xz bzip2 gzip sudo iproute wget"
FEDORA_IMAGE="docker://fedora:23"
ACBUILD_URL="https://github.com/appc/acbuild/releases/download/v0.2.2/acbuild.tar.gz"
ACBUILD="acbuild --debug"
BUILDFLAGS="-a --ldflags '-extldflags \"-static\"'"
TAG=$(git describe --exact-match --abbrev=0) || TAG=$(git describe)
RELEASE_DIR=release-${TAG}
@ -25,7 +26,7 @@ sudo -E rkt run \
${FEDORA_IMAGE} \
--exec /bin/bash \
-- -xe -c "\
${FEDORA_INSTALL}; cd /opt/src; umask 0022; ./build-static; ./test || true; \
${FEDORA_INSTALL}; cd /opt/src; umask 0022; CGO_ENABLED=0 ./build ${BUILDFLAGS}; \
for format in txz tbz2 tgz; do \
FILENAME=cni-${TAG}.\$format; \
FILEPATH=${RELEASE_DIR}/\$FILENAME; \