Skip to content

Commit

Permalink
calico-node: backport ipset to v3.12.1
Browse files Browse the repository at this point in the history
FROM following references:

- [Incompatible ipset protocol version (7) will cause problems](projectcalico/calico#5011)
- [Update Node Dockerfile to install ipset 7.11](projectcalico/calico#5485)
- [update ipset for arm64](projectcalico/calico#6262)
  • Loading branch information
zexi committed Dec 19, 2023
1 parent 830d383 commit 46a2bfa
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
36 changes: 36 additions & 0 deletions calico-node/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG IPSET_VER=7.11-6

FROM quay.io/centos/centos:stream8 as centos

ARG IPSET_VER
ARG STREAM9_MIRROR_BASE_URL=https://iad.mirror.rackspace.com/centos-stream/9-stream
ARG IPSET_SOURCERPM_URL=${STREAM9_MIRROR_BASE_URL}/BaseOS/source/tree/Packages/ipset-${IPSET_VER}.el9.src.rpm

# Install build dependencies and security updates.
RUN dnf install -y 'dnf-command(config-manager)' && \
# Enable PowerTools repo for '-devel' packages
dnf config-manager --set-enabled powertools && \
# Install required packages for building rpms. yum-utils is not required but it gives us yum-builddep to easily install build deps.
yum install --allowerasing -y rpm-build yum-utils make && \
# Need these to build runit.
yum install --allowerasing -y wget glibc-static gcc && \
# Ensure all security updates are installed.
yum -y update-minimal --security

# Install source RPM for ipset and install its build dependencies.
RUN rpm -i ${IPSET_SOURCERPM_URL} && \
yum-builddep -y --spec /root/rpmbuild/SPECS/ipset.spec && \
rpmbuild -bb /root/rpmbuild/SPECS/ipset.spec

FROM registry.cn-beijing.aliyuncs.com/yunionio/calico-node:v3.12.1
ARG IPSET_VER
ARG ARCH=x86_64

# Copy in our rpms
COPY --from=centos /root/rpmbuild/RPMS/${ARCH}/* /tmp/rpms/

# remove old ipset package
RUN rpm -e --allmatches --nodeps --noscripts --notriggers ipset-libs ipset && \
# Install ipset version
rpm --force -i /tmp/rpms/ipset-libs-${IPSET_VER}.el8.x86_64.rpm && \
rpm -i /tmp/rpms/ipset-${IPSET_VER}.el8.x86_64.rpm
17 changes: 17 additions & 0 deletions calico-node/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
REPO?=registry.cn-beijing.aliyuncs.com/yunionio/calico-node
VERSION:=v3.12.1
REL:=ipset-6
TAG:=$(VERSION)-$(REL)

IMG:=$(REPO):$(TAG)

all: image

image:
docker buildx build -t $(IMG)-amd64 -f ./Dockerfile.amd64 --push --platform linux/amd64 .
docker pull --platform "linux/amd64" $(IMG)-amd64
docker pull --platform "linux/arm64" $(REPO):$(VERSION)

manifest: image
docker buildx imagetools create -t $(IMG) $(IMG)-amd64 $(REPO):$(VERSION)
docker manifest inspect $(IMG)

0 comments on commit 46a2bfa

Please sign in to comment.