Skip to content

Commit

Permalink
feat: upgrade CRIU and remove nftables
Browse files Browse the repository at this point in the history
we don't need net-lock anymore, so we can stop building with nftables
and have a single CRIU version for all supported platforms.
  • Loading branch information
ctrox committed Jan 3, 2024
1 parent f27a5f0 commit f04dab3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_push_criu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
env:
REGISTRY: ghcr.io
CRIU_IMAGE_NAME: ${{ github.repository }}-criu
CRIU_VERSION: a2c4dd2
CRIU_VERSION: v3.19

jobs:
push_to_registry:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ NAMESPACE := ctrox
INSTALLER_IMAGE := $(REGISTRY)/$(NAMESPACE)/zeropod-installer:dev
MANAGER_IMAGE := $(REGISTRY)/$(NAMESPACE)/zeropod-manager:dev
TEST_IMAGE := $(REGISTRY)/$(NAMESPACE)/zeropod-test:dev
# a2c4dd2 allows skipping iptables/nftables
CRIU_VERSION := a2c4dd2
CRIU_VERSION := v3.19
CRIU_IMAGE := $(REGISTRY)/$(NAMESPACE)/zeropod-criu:$(CRIU_VERSION)
DOCKER_SOCK := /var/run/docker.sock
EBPF_IMAGE := $(REGISTRY)/$(NAMESPACE)/zeropod-ebpf:dev
Expand Down
13 changes: 1 addition & 12 deletions cmd/installer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
)

var (
criuImage = flag.String("criu-image", "ghcr.io/ctrox/zeropod-criu:a2c4dd2", "criu image to use.")
criuNFTables = flag.Bool("criu-nftables", true, "use criu with nftables")
criuImage = flag.String("criu-image", "ghcr.io/ctrox/zeropod-criu:v3.19", "criu image to use.")
runtime = flag.String("runtime", "containerd", "specifies which runtime to configure. containerd/k3s/rke2")
hostOptPath = flag.String("host-opt-path", "/opt/zeropod", "path where zeropod binaries are stored on the host")
uninstall = flag.Bool("uninstall", false, "uninstalls zeropod by cleaning up all the files the installer created")
Expand Down Expand Up @@ -147,16 +146,6 @@ func installCriu(ctx context.Context) error {
return err
}

if !*criuNFTables {
log.Println("nftables disabled, installing criu with iptables")
// if we don't have nftables support, we need to use the criu binary
// without nftables support compiled in as the config alone does not seem
// to do the trick :/
if err := os.Rename(filepath.Join(optPath, "bin", criuIPTablesBin), filepath.Join(optPath, "bin", defaultCriuBin)); err != nil {
return err
}
}

// write the criu config
if err := os.MkdirAll(path.Dir(criuConfigFile), os.ModePerm); err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions config/gke/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ patchesStrategicMerge:
- daemonset.yaml
patches:
- patch: |-
# gke does not have nftables support (yet, dev kernel supports it)
- op: add
path: /spec/template/spec/containers/1/args/-
value: -criu-nftables=false
- op: add
path: /spec/template/spec/containers/1/args/-
value: -host-opt-path=/var/lib/toolbox/zeropod
Expand Down
13 changes: 2 additions & 11 deletions criu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,22 @@
FROM ubuntu:20.04 as build
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
git build-essential libprotobuf-dev libprotobuf-c-dev \
protobuf-c-compiler protobuf-compiler python-protobuf \
protobuf-c-compiler protobuf-compiler python3-protobuf \
libcap-dev libnl-3-dev libnet-dev pkg-config curl ca-certificates

WORKDIR /workspace

RUN git clone https://github.com/checkpoint-restore/criu.git
WORKDIR /workspace/criu
ARG CRIU_VERSION=v3.18
ARG CRIU_VERSION=v3.19
RUN git checkout $CRIU_VERSION

RUN make -j $(nproc)
RUN mv ./criu/criu ./criu/criu-iptables

# build with nftables support
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libnftables-dev
RUN make clean && make -j $(nproc)

# we just add libs and binaries from scratch so this image can be used with
# containerd's client.Install.
FROM scratch AS export-stage
COPY --from=build /workspace/criu/criu/criu /bin/
COPY --from=build /workspace/criu/criu/criu-iptables /bin/
COPY --from=build /usr/lib/*-linux-gnu/libprotobuf-c.so.1 /lib/
COPY --from=build /lib/*-linux-gnu/libnl-3.so.200 /lib/
COPY --from=build /usr/lib/*-linux-gnu/libnet.so.1 /lib/
COPY --from=build /lib/*-linux-gnu/libnftables.so.1 /lib/
COPY --from=build /lib/*-linux-gnu/libnftnl.so.11 /lib/
COPY --from=build /lib/*-linux-gnu/libjansson.so.4 /lib/

0 comments on commit f04dab3

Please sign in to comment.