Skip to content

Commit

Permalink
chore: optimize dpdk build
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Jul 29, 2020
1 parent 6827a9f commit 4676817
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-arm64-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
build:
name: Build
name: Build arm64
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/build-dpdk-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build dpdk Image
on:
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'yamls/**'
push:
branches:
- master
- release-*
paths-ignore:
- 'docs/**'
- 'yamls/**'

jobs:
build:
name: Build DPDK
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1.4.0

- name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-dpdk-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-dpdk-buildx-
- name: Build
run: |
go get -u github.com/securego/gosec/cmd/gosec
make build-dpdk
- name: Push
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'release') }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
COMMIT: ${{ github.sha }}
run: |
TAG=$(cat VERSION)
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker tag kubeovn/kube-ovn:$TAG kubeovn/kube-ovn-dpdk:19.11-$TAG
docker tag kubeovn/kube-ovn:$TAG kubeovn/kube-ovn-dpdk:19.11-$COMMIT
docker images
docker push kubeovn/kube-ovn:$TAG kubeovn/kube-ovn-dpdk:19.11-$TAG
docker push kubeovn/kube-ovn:$TAG kubeovn/kube-ovn-dpdk:19.11-$COMMIT
2 changes: 1 addition & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
build:
name: Build
name: Build x86
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* CRD version upgrade to v1
* Refactor ovs cmd with ovs.Exec
* OVS-DPDK support config file
* Reduce image size of ovs-dpdk
* Reduce image size of OVS-DPDK

## v1.2.1 -- 2020/06/22
This release fix bugs found in v1.2.0
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ ARCH=amd64
# RPM_ARCH could be x86_64,aarch64
RPM_ARCH=x86_64

.PHONY: build-dev-images build-go build-bin lint kind-init kind-init-ha kind-install kind-reload push-dev push-release e2e ut
.PHONY: build-dev-images build-dpdk build-go build-bin lint kind-init kind-init-ha kind-install kind-reload push-dev push-release e2e ut

build-dev-images: build-bin
docker build -t ${REGISTRY}/kube-ovn:${DEV_TAG} -f dist/images/Dockerfile dist/images/

build-dpdk:
docker buildx build --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --platform linux/amd64 -t ${REGISTRY}/kube-ovn-dpdk:19.11-${DEV_TAG} -o type=docker -f dist/images/Dockerfile.dpdk1911 dist/images/

push-dev:
docker push ${REGISTRY}/kube-ovn:${DEV_TAG}

Expand Down
4 changes: 2 additions & 2 deletions dist/images/Dockerfile.dpdk1911
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV RPM_ARCH=x86_64

ENV DPDK_VERSION=19.11.1
ENV OVS_VERSION=2.13.0
ENV OVN_VERSION=20.03
ENV OVN_VERSION=20.06

ENV DPDK_DIR=/usr/src/dpdk-stable-${DPDK_VERSION}
ENV OVS_DIR=/usr/src/openvswitch-${OVS_VERSION}
Expand Down Expand Up @@ -53,7 +53,7 @@ RUN cd /usr/src/ && \

# Build OVN
RUN cd /usr/src/ && \
curl -L https://github.com/ovn-org/ovn/tarball/branch-20.03 > ovn.tar.gz && \
curl -L https://github.com/ovn-org/ovn/tarball/branch-${OVN_VERSION} > ovn.tar.gz && \
mkdir ovn && tar -xf ovn.tar.gz -C ovn --strip-components 1 && \
rm -f ovn.tar.gz && \
cd ovn && \
Expand Down
2 changes: 1 addition & 1 deletion dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ spec:
hostPID: true
containers:
- name: openvswitch
image: "kubeovn/kube-ovn-dpdk:$DPDK_VERSION"
image: "kubeovn/kube-ovn-dpdk:$DPDK_VERSION-$VERSION"
imagePullPolicy: $IMAGE_PULL_POLICY
command: ["/kube-ovn/start-ovs-dpdk.sh"]
securityContext:
Expand Down

0 comments on commit 4676817

Please sign in to comment.