Skip to content

Commit 1adaf97

Browse files
committed
Support Additional Layer Store
Signed-off-by: Kohei Tokunaga <[email protected]>
1 parent f5609bf commit 1adaf97

Some content is hidden

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

55 files changed

+3748
-1681
lines changed

.github/workflows/benchmark.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
BENCHMARK_SAMPLES_NUM: 5
1818
BENCHMARK_PERCENTILE: 95
1919
BENCHMARK_PERCENTILES_GRANULARITY: 25
20+
strategy:
21+
fail-fast: false
22+
max-parallel: 1
23+
matrix:
24+
runtime: ["podman", "containerd"]
2025
steps:
2126
- name: Install tools
2227
run: |
@@ -31,9 +36,11 @@ jobs:
3136
jq '{ location : .compute.location, vmSize : .compute.vmSize }' | \
3237
tee ${{ env.BENCHMARK_RESULT_DIR }}/instance.json
3338
- name: Run benchmark
39+
env:
40+
BENCHMARK_RUNTIME_MODE: ${{ matrix.runtime }}
3441
run: make benchmark
3542
- uses: actions/upload-artifact@v1
3643
if: ${{ always() }}
3744
with:
38-
name: benchmarking-result
45+
name: benchmarking-result-${{ matrix.runtime }}
3946
path: ${{ env.BENCHMARK_RESULT_DIR }}

.github/workflows/tests.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ jobs:
8989
BUILTIN_SNAPSHOTTER: ${{ matrix.builtin }}
9090
run: make test-pullsecrets
9191

92-
test-cri:
92+
test-cri-containerd:
9393
runs-on: ubuntu-20.04
94-
name: CRIValidation
94+
name: CRIValidationContainerd
9595
strategy:
9696
fail-fast: false
9797
matrix:
@@ -102,11 +102,19 @@ jobs:
102102
builtin: "true"
103103
steps:
104104
- uses: actions/checkout@v2
105-
- name: Varidate the runtime through CRI
105+
- name: Validate containerd through CRI
106106
env:
107107
DOCKER_BUILD_ARGS: ${{ matrix.buildargs }}
108108
BUILTIN_SNAPSHOTTER: ${{ matrix.builtin }}
109-
run: make test-cri
109+
run: make test-cri-containerd
110+
111+
test-cri-cri-o:
112+
runs-on: ubuntu-20.04
113+
name: CRIValidationCRIO
114+
steps:
115+
- uses: actions/checkout@v2
116+
- name: Validate CRI-O through CRI
117+
run: make test-cri-o
110118

111119
#
112120
# Project checks

Dockerfile

+112
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ ARG RUNC_VERSION=v1.0.0-rc93
1717
ARG CNI_PLUGINS_VERSION=v0.9.1
1818
ARG NERDCTL_VERSION=0.8.1
1919

20+
ARG PODMAN_VERSION=ed6f399770946bb2e88f8b94e1d2f279208648d4
21+
ARG CRIO_VERSION=7a7df87127ede57c26d666de9e926d6200637f95
22+
ARG CONMON_VERSION=v2.0.26
23+
ARG COMMON_VERSION=v0.37.1
24+
ARG CRIO_TEST_PAUSE_IMAGE_NAME=k8s.gcr.io/pause:3.5
25+
2026
# Legacy builder that doesn't support TARGETARCH should set this explicitly using --build-arg.
2127
# If TARGETARCH isn't supported by the builder, the default value is "amd64".
2228

@@ -65,6 +71,51 @@ RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
6571
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make containerd-stargz-grpc && \
6672
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${CTR_REMOTE_BUILD_FLAGS} make ctr-remote
6773

74+
# Build stargz store
75+
FROM golang-base AS stargz-store-dev
76+
ARG TARGETARCH
77+
ARG GOARM
78+
ARG SNAPSHOTTER_BUILD_FLAGS
79+
ARG CTR_REMOTE_BUILD_FLAGS
80+
COPY . $GOPATH/src/github.com/containerd/stargz-snapshotter
81+
RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \
82+
PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make stargz-store
83+
84+
# Build podman
85+
FROM golang-base AS podman-dev
86+
ARG PODMAN_VERSION
87+
RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
88+
git clone https://github.com/containers/podman $GOPATH/src/github.com/containers/podman && \
89+
cd $GOPATH/src/github.com/containers/podman && \
90+
git checkout ${PODMAN_VERSION} && \
91+
make && make install PREFIX=/out/
92+
93+
# Build CRI-O
94+
FROM golang-base AS cri-o-dev
95+
ARG CRIO_VERSION
96+
RUN apt-get update -y && apt-get install -y libseccomp-dev libgpgme-dev && \
97+
git clone https://github.com/cri-o/cri-o $GOPATH/src/github.com/cri-o/cri-o && \
98+
cd $GOPATH/src/github.com/cri-o/cri-o && \
99+
git checkout ${CRIO_VERSION} && \
100+
make && make install PREFIX=/out/ && \
101+
curl -sSL --output /out/crio.service https://raw.githubusercontent.com/cri-o/cri-o/${CRIO_VERSION}/contrib/systemd/crio.service
102+
103+
# Build conmon
104+
FROM golang-base AS conmon-dev
105+
ARG CONMON_VERSION
106+
RUN apt-get update -y && apt-get install -y gcc git libc6-dev libglib2.0-dev pkg-config make && \
107+
git clone -b ${CONMON_VERSION} --depth 1 \
108+
https://github.com/containers/conmon $GOPATH/src/github.com/containers/conmon && \
109+
cd $GOPATH/src/github.com/containers/conmon && \
110+
mkdir /out/ && make && make install PREFIX=/out/
111+
112+
# Get seccomp.json for Podman/CRI-O
113+
FROM golang-base AS containers-common-dev
114+
ARG COMMON_VERSION
115+
RUN git clone https://github.com/containers/common $GOPATH/src/github.com/containers/common && \
116+
cd $GOPATH/src/github.com/containers/common && \
117+
git checkout ${COMMON_VERSION} && mkdir /out/ && cp pkg/seccomp/seccomp.json /out/
118+
68119
# Binaries for release
69120
FROM scratch AS release-binaries
70121
COPY --from=snapshotter-dev /out/* /
@@ -98,6 +149,37 @@ COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
98149
COPY --from=snapshotter-dev /out/ctr-remote /usr/local/bin/
99150
RUN ln -s /usr/local/bin/ctr-remote /usr/local/bin/ctr
100151

152+
# Base image which contains podman with stargz-store
153+
FROM golang-base AS podman-base
154+
ARG TARGETARCH
155+
ARG CNI_PLUGINS_VERSION
156+
ARG PODMAN_VERSION
157+
RUN apt-get update -y && apt-get --no-install-recommends install -y fuse libgpgme-dev \
158+
iptables libyajl-dev && \
159+
# Make CNI plugins manipulate iptables instead of nftables
160+
# as this test runs in a Docker container that network is configured with iptables.
161+
# c.f. https://github.com/moby/moby/issues/26824
162+
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
163+
mkdir -p /etc/containers /etc/cni/net.d /opt/cni/bin && \
164+
curl -qsSL https://raw.githubusercontent.com/containers/podman/${PODMAN_VERSION}/cni/87-podman-bridge.conflist | tee /etc/cni/net.d/87-podman-bridge.conflist && \
165+
curl -Ls https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${TARGETARCH:-amd64}-${CNI_PLUGINS_VERSION}.tgz | tar xzv -C /opt/cni/bin
166+
167+
COPY --from=podman-dev /out/bin/* /usr/local/bin/
168+
COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
169+
COPY --from=conmon-dev /out/bin/* /usr/local/bin/
170+
COPY --from=containers-common-dev /out/seccomp.json /usr/share/containers/
171+
COPY --from=stargz-store-dev /out/* /usr/local/bin/
172+
173+
# Image which can be used as all-in-one single node demo environment
174+
FROM snapshotter-base AS cind
175+
COPY ./script/config/ /
176+
COPY ./script/cind/ /
177+
VOLUME /var/lib/containerd
178+
VOLUME /var/lib/containerd-stargz-grpc
179+
VOLUME /run/containerd-stargz-grpc
180+
ENV CONTAINERD_SNAPSHOTTER=stargz
181+
ENTRYPOINT [ "/entrypoint.sh" ]
182+
101183
# Image which can be used for interactive demo environment
102184
FROM containerd-base AS demo
103185
ARG CNI_PLUGINS_VERSION
@@ -118,6 +200,36 @@ COPY ./script/config/ /
118200
RUN apt-get update -y && apt-get install --no-install-recommends -y fuse
119201
ENTRYPOINT [ "/usr/local/bin/entrypoint", "/sbin/init" ]
120202

203+
# Image for testing CRI-O with Stargz Store.
204+
# NOTE: This cannot be used for the node image of KinD.
205+
FROM ubuntu:20.04 AS crio-stargz-store
206+
ARG CNI_PLUGINS_VERSION
207+
ARG CRIO_TEST_PAUSE_IMAGE_NAME
208+
ENV container docker
209+
RUN apt-get update -y && apt-get install --no-install-recommends -y \
210+
ca-certificates fuse libgpgme-dev libglib2.0-dev curl \
211+
iptables conntrack systemd systemd-sysv && \
212+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y tzdata && \
213+
# Make CNI plugins manipulate iptables instead of nftables
214+
# as this test runs in a Docker container that network is configured with iptables.
215+
# c.f. https://github.com/moby/moby/issues/26824
216+
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
217+
mkdir -p /opt/cni/bin && \
218+
curl -sSL https://github.com/containernetworking/plugins/releases/download/${CNI_PLUGINS_VERSION}/cni-plugins-linux-${TARGETARCH:-amd64}-${CNI_PLUGINS_VERSION}.tgz | tar xzv -C /opt/cni/bin && \
219+
echo ${CRIO_TEST_PAUSE_IMAGE_NAME} > /pause_name && \
220+
mkdir -p /etc/sysconfig && \
221+
echo CRIO_RUNTIME_OPTIONS=--pause-image=${CRIO_TEST_PAUSE_IMAGE_NAME} > /etc/sysconfig/crio
222+
223+
COPY --from=stargz-store-dev /out/* /usr/local/bin/
224+
COPY --from=cri-o-dev /out/bin/* /usr/local/bin/
225+
COPY --from=cri-o-dev /out/crio.service /etc/systemd/system/
226+
COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
227+
COPY --from=conmon-dev /out/bin/* /usr/local/bin/
228+
COPY --from=containers-common-dev /out/seccomp.json /usr/share/containers/
229+
COPY ./script/config-cri-o/ /
230+
231+
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
232+
121233
# Image which can be used as a node image for KinD
122234
FROM kindest/node:v1.20.0
123235
COPY --from=containerd-dev /out/bin/containerd /out/bin/containerd-shim-runc-v2 /usr/local/bin/

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
2323
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
2424
GO_LD_FLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) $(GO_EXTRA_LDFLAGS)'
2525

26-
CMD=containerd-stargz-grpc ctr-remote
26+
CMD=containerd-stargz-grpc ctr-remote stargz-store
2727

2828
CMD_BINARIES=$(addprefix $(PREFIX),$(CMD))
2929

@@ -41,6 +41,9 @@ containerd-stargz-grpc: FORCE
4141
ctr-remote: FORCE
4242
GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) -v ./cmd/ctr-remote
4343

44+
stargz-store: FORCE
45+
GO111MODULE=$(GO111MODULE_VALUE) go build -o $(PREFIX)$@ $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) -v ./cmd/stargz-store
46+
4447
check:
4548
@echo "$@"
4649
@GO111MODULE=$(GO111MODULE_VALUE) golangci-lint run
@@ -85,5 +88,8 @@ benchmark:
8588
test-pullsecrets:
8689
@./script/pullsecrets/test.sh
8790

88-
test-cri:
89-
@./script/cri/test.sh
91+
test-cri-containerd:
92+
@./script/cri-containerd/test.sh
93+
94+
test-cri-o:
95+
@./script/cri-o/test.sh

0 commit comments

Comments
 (0)