Skip to content

Commit

Permalink
ci: build amd64 images without avx512 (#1584)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Jun 13, 2022
1 parent b745379 commit 7fdb4bc
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-arm64-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Go Build Cache
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-dpdk-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-kube-ovn-base-dpdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build
run: |
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/build-kube-ovn-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build
run: |
Expand All @@ -31,13 +31,12 @@ jobs:
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:qemu-v5.2.0
platforms: arm64

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Build
run: |
Expand Down Expand Up @@ -87,6 +86,9 @@ jobs:
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker images
docker push kubeovn/kube-ovn-base:$TAG-amd64
docker push kubeovn/kube-ovn-base:$TAG-amd64-no-avx512
docker push kubeovn/kube-ovn-base:$TAG-arm64
docker manifest create kubeovn/kube-ovn-base:$TAG kubeovn/kube-ovn-base:$TAG-amd64 kubeovn/kube-ovn-base:$TAG-arm64
docker manifest push kubeovn/kube-ovn-base:$TAG
docker manifest create kubeovn/kube-ovn-base:$TAG-no-avx512 kubeovn/kube-ovn-base:$TAG-amd64-no-avx512
docker manifest push kubeovn/kube-ovn-base:$TAG-no-avx512
15 changes: 9 additions & 6 deletions .github/workflows/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,32 @@ jobs:
- name: Check out OVS
uses: actions/checkout@v3
with:
repository: openvswitch/ovs
ref: master
repository: kubeovn/ovs
ref: ovn-22.03.1
path: ovs

- name: Check out OVN
uses: actions/checkout@v3
with:
repository: ovn-org/ovn
ref: branch-22.03
ref: v22.03.1
path: ovn

- name: Apply OVS patches
working-directory: ovs
run: |
# Carefully release NBL in Windows
Invoke-WebRequest -Uri "https://github.com/openvswitch/ovs/commit/bb78070fc7ec0d67e80d9d15de482ef830196da3.patch" -OutFile ..\ovs-01.patch
# fix kernel crash
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/64383c14a9c25e9e0ca53c6758d9499c60132536.patch" -OutFile ..\ovs-01.patch
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/64383c14a9c25e9e0ca53c6758d9499c60132536.patch" -OutFile ..\ovs-02.patch
# support for building in github actions
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/08a95db2ca506fce4d89fdf4fafab74607b2bb9f.patch" -OutFile ..\ovs-02.patch
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/08a95db2ca506fce4d89fdf4fafab74607b2bb9f.patch" -OutFile ..\ovs-03.patch
# listen on tcp 127.0.0.1:6643 by default
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/680e77a190ae7df3086bc35bb6150238e97f9020.patch" -OutFile ..\ovs-03.patch
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/680e77a190ae7df3086bc35bb6150238e97f9020.patch" -OutFile ..\ovs-04.patch
git apply ..\ovs-01.patch
git apply ..\ovs-02.patch
git apply ..\ovs-03.patch
git apply ..\ovs-04.patch
- name: Apply OVN patches
working-directory: ovn
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Go Build Cache
uses: actions/cache@v3
Expand Down Expand Up @@ -1285,6 +1285,7 @@ jobs:
# docker tag kubeovn/centos8-compile:$TAG kubeovn/centos8-compile:$TAG-x86
docker images
docker push kubeovn/kube-ovn:$TAG-x86
docker push kubeovn/kube-ovn:$TAG-no-avx512
docker push kubeovn/kube-ovn-dev:$COMMIT-x86
docker push kubeovn/vpc-nat-gateway:$TAG-x86
docker push kubeovn/vpc-nat-gateway-dev:$COMMIT-x86
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-multiarch-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v3

- name: Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Push
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ build-dpdk:
.PHONY: base-amd64
base-amd64:
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64 -o type=docker -f dist/images/Dockerfile.base dist/images/
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 --build-arg NO_AVX512=true -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64-no-avx512 -o type=docker -f dist/images/Dockerfile.base dist/images/

.PHONY: base-amd64-dpdk
base-amd64-dpdk:
Expand All @@ -67,6 +68,7 @@ base-arm64:
.PHONY: release
release: lint build-go
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-no-avx512 -o type=docker -f dist/images/Dockerfile.no-avx512 dist/images/
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-dpdk -o type=docker -f dist/images/Dockerfile.dpdk dist/images/
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o type=docker -f dist/images/vpcnatgateway/Dockerfile dist/images/vpcnatgateway
docker buildx build --platform linux/amd64 --build-arg ARCH=amd64 -t $(REGISTRY)/centos7-compile:$(RELEASE_TAG) -o type=docker -f dist/images/compile/centos7/Dockerfile fastpath/
Expand All @@ -87,14 +89,14 @@ push-release: release

.PHONY: tar
tar:
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) -o kube-ovn.tar
docker save $(REGISTRY)/kube-ovn:$(RELEASE_TAG) $(REGISTRY)/kube-ovn:$(RELEASE_TAG)-no-avx512 -o kube-ovn.tar
docker save $(REGISTRY)/vpc-nat-gateway:$(RELEASE_TAG) -o vpc-nat-gateway.tar
docker save $(REGISTRY)/centos7-compile:$(RELEASE_TAG) -o centos7-compile.tar
# docker save $(REGISTRY)/centos8-compile:$(RELEASE_TAG) -o centos8-compile.tar

.PHONY: base-tar-amd64
base-tar-amd64:
docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64 -o image-amd64.tar
docker save $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64 $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-amd64-no-avx512 -o image-amd64.tar

.PHONY: base-tar-amd64-dpdk
base-tar-amd64-dpdk:
Expand Down
9 changes: 0 additions & 9 deletions dist/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# syntax = docker/dockerfile:experimental
FROM kubeovn/kube-ovn-base:v1.11.0

ARG ARCH
ENV DUMB_INIT_VERSION="1.2.5"
RUN dump_arch="x86_64"; \
if [ "$ARCH" = "arm64" ]; then dump_arch="aarch64"; fi; \
curl -sSf -L --retry 5 -o /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${dump_arch} && \
chmod +x /usr/bin/dumb-init

COPY *.sh /kube-ovn/
COPY kubectl-ko /kube-ovn/kubectl-ko
COPY 01-kube-ovn.conflist /kube-ovn/01-kube-ovn.conflist
Expand All @@ -26,5 +19,3 @@ RUN ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-speaker && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-controller-healthcheck && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-leader-checker

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
15 changes: 13 additions & 2 deletions dist/images/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
FROM ubuntu:22.04 as ovs-builder

ARG ARCH
ARG NO_AVX512=false
ARG DEBIAN_FRONTEND=noninteractive
ENV SRC_DIR='/usr/src'

Expand All @@ -11,10 +12,12 @@ RUN apt update && apt install build-essential git libnuma-dev autoconf curl \
flake8 python3-sphinx graphviz groff wget libjemalloc-dev -y

RUN cd /usr/src/ && \
git clone -b branch-2.17 --depth=1 https://github.com/openvswitch/ovs.git && \
git clone -b ovn-22.03.1 --depth=1 https://github.com/kubeovn/ovs.git && \
cd ovs && \
# increase election timer
curl -s https://github.com/kubeovn/ovs/commit/22ea22c40b46ee5adeae977ff6cfca81b3ff25d7.patch | git apply && \
# compile without avx512
if [ "$ARCH" = "amd64" -a "$NO_AVX512" = "true" ]; then curl -s https://github.com/kubeovn/ovs/commit/38c59e078d69b343f56ab0f380fb9f42b94b7c02.patch | git apply; fi && \
./boot.sh && \
rm -rf .git && \
CONFIGURE_OPTS='LIBS=-ljemalloc' && \
Expand All @@ -23,7 +26,7 @@ RUN cd /usr/src/ && \

RUN dpkg -i /usr/src/python3-openvswitch*.deb /usr/src/libopenvswitch*.deb

RUN cd /usr/src/ && git clone -b branch-22.03 --depth=1 https://github.com/ovn-org/ovn.git && \
RUN cd /usr/src/ && git clone -b v22.03.1 --depth=1 https://github.com/ovn-org/ovn.git && \
cd ovn && \
# do not send traffic that not designate to svc to conntrack
curl -s https://github.com/kubeovn/ovn/commit/d26ae4de0ab070f6b602688ba808c8963f69d5c4.patch | git apply && \
Expand Down Expand Up @@ -75,3 +78,11 @@ RUN --mount=type=bind,target=/packages,from=ovs-builder,source=/packages \
dpkg -i /packages/openvswitch-*.deb && \
dpkg -i /packages/python3-openvswitch*.deb &&\
dpkg -i --ignore-depends=openvswitch-switch,openvswitch-common /packages/ovn-*.deb

ENV DUMB_INIT_VERSION="1.2.5"
RUN dump_arch="x86_64"; \
if [ "$ARCH" = "arm64" ]; then dump_arch="aarch64"; fi; \
curl -sSf -L --retry 5 -o /usr/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_${dump_arch} && \
chmod +x /usr/bin/dumb-init

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
21 changes: 21 additions & 0 deletions dist/images/Dockerfile.no-avx512
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax = docker/dockerfile:experimental
FROM kubeovn/kube-ovn-base:v1.11.0-no-avx512

COPY *.sh /kube-ovn/
COPY kubectl-ko /kube-ovn/kubectl-ko
COPY 01-kube-ovn.conflist /kube-ovn/01-kube-ovn.conflist
COPY logrotate/* /etc/logrotate.d/
COPY grace_stop_ovn_controller /usr/share/ovn/scripts/grace_stop_ovn_controller

WORKDIR /kube-ovn

COPY kube-ovn-cmd /kube-ovn/kube-ovn-cmd
COPY kube-ovn-webhook /kube-ovn/kube-ovn-webhook
RUN ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-controller && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-daemon && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-monitor && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-pinger && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-speaker && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-controller-healthcheck && \
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-leader-checker

0 comments on commit 7fdb4bc

Please sign in to comment.