X Tutup
Skip to content

Commit 5bd99af

Browse files
authored
Merge pull request containerd#2097 from Random-Liu/vendor-cri-plugin
Vendor cri plugin into containerd.
2 parents 9463fcb + fa91b90 commit 5bd99af

File tree

701 files changed

+226382
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

701 files changed

+226382
-3
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ addons:
2626
- libaio-dev
2727
- libprotobuf-c0-dev
2828
- libprotobuf-dev
29+
- socat
2930

3031
env:
3132
- TRAVIS_GOOS=linux TRAVIS_CGO_ENABLED=1
@@ -35,6 +36,8 @@ before_install:
3536
- uname -r
3637
- sudo apt-get -q update
3738
- sudo apt-get install -y libseccomp-dev/trusty-backports
39+
# Use jpetazzo/nsenter to install nsenter on ubuntu trusty.
40+
- docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter
3841

3942
install:
4043
- sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-protobuf
@@ -44,6 +47,8 @@ install:
4447
- protoc --version
4548
- go get -u github.com/vbatts/git-validation
4649
- sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-runc
50+
- sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-cni
51+
- sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-critools
4752
- wget https://github.com/xemul/criu/archive/v3.0.tar.gz -O /tmp/criu.tar.gz
4853
- tar -C /tmp/ -zxf /tmp/criu.tar.gz
4954
- cd /tmp/criu-3.0 && sudo make install-criu
@@ -66,6 +71,14 @@ script:
6671
- if [ "$GOOS" = "linux" ]; then sudo PATH=$PATH GOPATH=$GOPATH make integration ; fi
6772
# Run the integration suite a second time. See discussion in github.com/containerd/containerd/pull/1759
6873
- if [ "$GOOS" = "linux" ]; then sudo PATH=$PATH GOPATH=$GOPATH TESTFLAGS_PARALLEL=1 make integration ; fi
74+
- if [ "$GOOS" = "linux" ]; then
75+
sudo PATH=$PATH containerd -log-level debug &> /tmp/containerd-cri.log &
76+
sudo PATH=$PATH GOPATH=$GOPATH critest --runtime-endpoint=/var/run/containerd/containerd.sock validation ;
77+
exit_code=$? ;
78+
test $exit_code -ne 0 && cat /tmp/containerd-cri.log ;
79+
sudo pkill containerd ;
80+
exit $exit_code ;
81+
fi
6982

7083
after_success:
7184
- bash <(curl -s https://codecov.io/bash) -F linux

BUILDING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,12 @@ compiler to regenerate the API generated code packages with:
6969
make generate
7070
```
7171

72-
> *Note*: A build tag is currently available to disable building the btrfs snapshot driver.
73-
> Adding `BUILDTAGS=no_btrfs` to your environment before calling the **binaries**
72+
> *Note*: Several build tags are currently available:
73+
> * `no_btrfs`: A build tag disables building the btrfs snapshot driver.
74+
> * `no_cri`: A build tag disables building Kubernetes [CRI](http://blog.kubernetes.io/2016/12/container-runtime-interface-cri-in-kubernetes.html) support into containerd.
75+
> See [here](https://github.com/containerd/cri-containerd#build-tags) for build tags of CRI plugin.
76+
>
77+
> For example, adding `BUILDTAGS=no_btrfs` to your environment before calling the **binaries**
7478
> Makefile target will disable the btrfs driver within the containerd Go build.
7579
7680
Vendoring of external imports uses the [`vndr` tool](https://github.com/LK4D4/vndr) which uses a simple config file, `vendor.conf`, to provide the URL and version or hash details for each vendored import. After modifying `vendor.conf` run the `vndr` tool to update the `vendor/` directory contents. Combining the `vendor.conf` update with the changeset in `vendor/` after running `vndr` should become a single commit for a PR which relies on vendored updates.

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ TEST_REQUIRES_ROOT_PACKAGES=$(filter \
7474
COMMANDS=ctr containerd containerd-stress containerd-release
7575
MANPAGES=ctr.1 containerd.1 config.toml.5 containerd-config.1
7676

77+
# Build tags seccomp and apparmor are needed by CRI plugin.
78+
BUILDTAGS ?= seccomp apparmor
7779
GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
7880
GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)'
7981
SHIM_GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) -extldflags "-static"'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// +build !no_cri
2+
3+
package main
4+
5+
import _ "github.com/containerd/cri-containerd"

script/setup/install-cni

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Builds and installs cni plugins to /opt/cni/bin,
4+
# and create basic cni config in /etc/cni/net.d.
5+
# The commit defined in vendor.conf
6+
#
7+
set -eu -o pipefail
8+
9+
CNI_COMMIT=$(grep containernetworking/plugins ${GOPATH}/src/github.com/containerd/containerd/vendor.conf | cut -d " " -f 2)
10+
CNI_DIR=/opt/cni
11+
CNI_CONFIG_DIR=/etc/cni/net.d
12+
13+
go get -d github.com/containernetworking/plugins/...
14+
cd $GOPATH/src/github.com/containernetworking/plugins
15+
git checkout $CNI_COMMIT
16+
FASTBUILD=true ./build.sh
17+
mkdir -p $CNI_DIR
18+
cp -r ./bin $CNI_DIR
19+
mkdir -p $CNI_CONFIG_DIR
20+
bash -c 'cat >'$CNI_CONFIG_DIR'/10-containerd-net.conflist <<EOF
21+
{
22+
"cniVersion": "0.3.1",
23+
"name": "containerd-net",
24+
"plugins": [
25+
{
26+
"type": "bridge",
27+
"bridge": "cni0",
28+
"isGateway": true,
29+
"ipMasq": true,
30+
"ipam": {
31+
"type": "host-local",
32+
"subnet": "10.88.0.0/16",
33+
"routes": [
34+
{ "dst": "0.0.0.0/0" }
35+
]
36+
}
37+
},
38+
{
39+
"type": "portmap",
40+
"capabilities": {"portMappings": true}
41+
}
42+
]
43+
}
44+
EOF'

script/setup/install-critools

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Builds and installs critools including critest and crictl
4+
# to /usr/local/bin.
5+
#
6+
set -eu -o pipefail
7+
8+
CRITEST_COMMIT=240a840375cdabb5860c75c99e8b0d0a776006b4
9+
go get -d github.com/kubernetes-incubator/cri-tools/...
10+
cd $GOPATH/src/github.com/kubernetes-incubator/cri-tools
11+
git checkout $CRITEST_COMMIT
12+
make
13+
make install

script/setup/install-runc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set -eu -o pipefail
2323

2424
RUNC_COMMIT=$(grep opencontainers/runc ${GOPATH}/src/github.com/containerd/containerd/vendor.conf | cut -d " " -f 2)
2525

26-
go get -u github.com/opencontainers/runc
26+
go get -d github.com/opencontainers/runc
2727
cd $GOPATH/src/github.com/opencontainers/runc
2828
git checkout $RUNC_COMMIT
2929
make BUILDTAGS="apparmor seccomp" runc install

vendor.conf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,35 @@ github.com/stevvooe/ttrpc d4528379866b0ce7e9d71f3eb96f0582fc374577
4242
github.com/syndtr/gocapability db04d3cc01c8b54962a58ec7e491717d06cfcc16
4343
github.com/gotestyourself/gotestyourself 44dbf532bbf5767611f6f2a61bded572e337010a
4444
github.com/google/go-cmp v0.1.0
45+
# cri dependencies
46+
github.com/containerd/cri-containerd 83573155645882403ef2da86df8ea95e2d031f28
47+
github.com/blang/semver v3.1.0
48+
github.com/containernetworking/cni v0.6.0
49+
github.com/containernetworking/plugins v0.6.0
50+
github.com/cri-o/ocicni 9b451e26eb7c694d564991fbf44f77d0afb9b03c
51+
github.com/davecgh/go-spew v1.1.0
52+
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
53+
github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
54+
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528
55+
github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46
56+
github.com/fsnotify/fsnotify 7d7316ed6e1ed2de075aab8dfc76de5d158d66e1
57+
github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee
58+
github.com/golang/glog 44145f04b68cf362d9c4df2182967c2275eaefed
59+
github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c
60+
github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55
61+
github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f
62+
github.com/json-iterator/go 1.0.4
63+
github.com/opencontainers/runtime-tools 6073aff4ac61897f75895123f7e24135204a404d
64+
github.com/opencontainers/selinux 4a2974bf1ee960774ffd517717f1f45325af0206
65+
github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0
66+
github.com/spf13/pflag v1.0.0
67+
github.com/tchap/go-patricia 5ad6cdb7538b0097d5598c7e57f0a24072adf7dc
68+
golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
69+
gopkg.in/inf.v0 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
70+
gopkg.in/yaml.v2 53feefa2559fb8dfa8d81baad31be332c97d6c77
71+
k8s.io/api a1d6dce6736a6c75929bb75111e89077e35a5856
72+
k8s.io/apimachinery 8259d997cf059cd83dc47e5f8074b7a7d7967c09
73+
k8s.io/apiserver 8e45eac9dff86447a5c2effe6a3d2cba70121ebf
74+
k8s.io/client-go 33bd23f75b6de861994706a322b0afab824b2171
75+
k8s.io/kubernetes 05944b1d2ca7f60b09762a330425108f48f6b603
76+
k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e

vendor/github.com/blang/semver/LICENSE

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/blang/semver/README.md

Lines changed: 191 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
X Tutup