From 44cf3c9cc2e3366888d7e5977f9322dc5d3190bd Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Fri, 27 Oct 2017 15:05:19 -0400 Subject: [PATCH] add cni plugins Signed-off-by: Jess Frazelle --- crio/Dockerfile | 13 +++++++++++++ crio/net.d/10-mynet.conf | 15 +++++++++++++++ crio/net.d/99-loopback.conf | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 crio/net.d/10-mynet.conf create mode 100644 crio/net.d/99-loopback.conf diff --git a/crio/Dockerfile b/crio/Dockerfile index 803bca9..7c51b20 100644 --- a/crio/Dockerfile +++ b/crio/Dockerfile @@ -1,6 +1,7 @@ # Usage: # docker run --rm -it \ # --privileged \ +# --net host \ # -v /var/lib/containers:/var/lib/containers \ # -v /var/run:/var/run \ # -v /dev:/dev \ @@ -15,6 +16,7 @@ LABEL maintainer "Jessie Frazelle " RUN apt-get update && apt-get install -y \ btrfs-tools \ ca-certificates \ + iptables \ libapparmor1 \ libassuan0 \ libdevmapper1.02.1 \ @@ -28,10 +30,12 @@ RUN apt-get update && apt-get install -y \ ENV OSTREE_VERSION v2017.12 ENV GO_VERSION 1.9.1 +ENV CNI_PLUGINS_VERSION v0.6.0 ENV RUNC_VERSION v1.0.0-rc4 ENV CRIO_VERSION v1.0.0 # Install ostree +# Install CNI plugins # Install runc (installs to /sbin/runc) # Install CRI-O (installs to /usr/bin/crio) # NOTE: The install docker the templates package is a stop gap for it not being @@ -75,6 +79,13 @@ RUN buildDeps=' \ && curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xzC /usr/local \ && export PATH=/go/bin:/usr/local/go/bin:$PATH \ && export GOPATH="$(mktemp -d)" \ + && git clone --depth 1 -b "$CNI_PLUGINS_VERSION" https://github.com/containernetworking/plugins.git "${GOPATH}/src/github.com/containernetworking/plugins" \ + && ( \ + cd "${GOPATH}/src/github.com/containernetworking/plugins" \ + && ./build.sh \ + && mkdir -p /opt/cni/bin \ + && mv bin/* /opt/cni/bin/ \ + ) \ && git clone --depth 1 -b "$RUNC_VERSION" https://github.com/opencontainers/runc.git "${GOPATH}/src/github.com/opencontainers/runc" \ && ( \ cd "${GOPATH}/src/github.com/opencontainers/runc" \ @@ -97,4 +108,6 @@ RUN buildDeps=' \ && rm -rf "$BUILDPATH" "$GOPATH" "/usr/local/go" \ && apt-get purge -y --auto-remove $buildDeps +COPY net.d /etc/cni/net.d + CMD [ "crio" ] diff --git a/crio/net.d/10-mynet.conf b/crio/net.d/10-mynet.conf new file mode 100644 index 0000000..91739e6 --- /dev/null +++ b/crio/net.d/10-mynet.conf @@ -0,0 +1,15 @@ +{ + "cniVersion": "0.2.0", + "name": "mynet", + "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" } + ] + } +} diff --git a/crio/net.d/99-loopback.conf b/crio/net.d/99-loopback.conf new file mode 100644 index 0000000..c33478e --- /dev/null +++ b/crio/net.d/99-loopback.conf @@ -0,0 +1,4 @@ +{ + "cniVersion": "0.2.0", + "type": "loopback" +}