Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable e2e tests for multiarch #830

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ test: license-check gofmt
go test -cover $(TEST_PACKAGES_EXPANDED)
cd dist; ./mk-docker-opts_tests.sh

e2e-test: dist/flanneld-$(TAG)-$(ARCH).docker
e2e-test: dist/flanneld-e2e-$(TAG)-$(ARCH).docker
$(MAKE) -C images/iperf3 ARCH=$(ARCH)
cd dist; ./functional-test.sh $(REGISTRY):$(TAG)-$(ARCH)

cover:
Expand Down Expand Up @@ -80,6 +81,18 @@ clean:
rm -f dist/*.docker
rm -f dist/*.tar.gz

dist/flanneld-e2e-$(TAG)-$(ARCH).docker:
# valid values for $ARCH are [amd64 arm arm64 ppc64le s390x]
docker run -e GOARM=$(GOARM) \
-u $(shell id -u):$(shell id -g) \
-v $(CURDIR):/go/src/github.com/coreos/flannel:ro \
-v $(CURDIR)/dist:/go/src/github.com/coreos/flannel/dist \
golang:1.8.3 /bin/bash -c '\
cd /go/src/github.com/coreos/flannel && \
CGO_ENABLED=1 make -e dist/flanneld && \
mv dist/flanneld dist/flanneld-$(ARCH)'
docker build -f Dockerfile.$(ARCH) -t $(REGISTRY):$(TAG)-$(ARCH) .

## Create a docker image on disk for a specific arch and tag
dist/flanneld-$(TAG)-$(ARCH).docker: dist/flanneld-$(ARCH) dist/iptables-$(ARCH)
docker build -f Dockerfile.$(ARCH) -t $(REGISTRY):$(TAG)-$(ARCH) .
Expand Down Expand Up @@ -242,4 +255,4 @@ run-local-kube-flannel-with-prereqs: run-etcd run-k8s-apiserver dist/flanneld

run-local-kube-flannel:
# Currently this requires the netconf to be in /etc/kube-flannel/net-conf.json
sudo NODE_NAME=test dist/flanneld --kube-subnet-mgr --kube-api-url http://127.0.0.1:8080
sudo NODE_NAME=test dist/flanneld --kube-subnet-mgr --kube-api-url http://127.0.0.1:8080
12 changes: 9 additions & 3 deletions dist/functional-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
# Uncomment to see what commands are being executed
#set -x

ETCD_IMG="quay.io/coreos/etcd:v3.0.3"
ETCD_IMG="quay.io/coreos/etcd:v3.2.7"

if [[ ${ARCH} == "ppc64le" ]]; then
ETCD_IMG+="-ppc64le"
elif [[ ${ARCH} == "arm64" ]]; then
ETCD_IMG+="-arm64"
fi
FLANNEL_NET="10.10.0.0/16"

usage() {
Expand Down Expand Up @@ -94,8 +100,8 @@ run_test() {
# Perf test - run iperf server on flannel1 and client on flannel2
if [ $exit_code -eq 0 ]; then
docker rm -f flannel-e2e-test-flannel1-iperf 2>/dev/null
docker run -d --name flannel-e2e-test-flannel1-iperf --net=container:flannel-e2e-test-flannel1 mlabbe/iperf3
docker run --rm --net=container:flannel-e2e-test-flannel2 mlabbe/iperf3 -c $ping_dest
docker run -d --name flannel-e2e-test-flannel1-iperf --net=container:flannel-e2e-test-flannel1 iperf3:latest
docker run --rm --net=container:flannel-e2e-test-flannel2 iperf3:latest -c $ping_dest
fi

docker stop flannel-e2e-test-flannel1 flannel-e2e-test-flannel2 >/dev/null
Expand Down
11 changes: 11 additions & 0 deletions images/iperf3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM BASEIMAGE

RUN apk add --update \
iperf3 \
&& rm -rf /var/cache/apk/*

EXPOSE 5201

ENTRYPOINT ["/usr/bin/iperf3"]

CMD ["--server","-p","5201"]
22 changes: 22 additions & 0 deletions images/iperf3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
IPERF_IMG ?= iperf3:latest

ARCH ?= amd64

TEMP_DIR := $(shell mktemp -d)

ifeq ($(ARCH),amd64)
BASEIMAGE=alpine:3.6
endif
ifeq ($(ARCH),arm64)
BASEIMAGE=aarch64/alpine:3.6
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE=ppc64le/alpine:3.6
endif

all: container

container:
cp ./* $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile
docker build --pull -t $(IPERF_IMG) -f $(TEMP_DIR)/Dockerfile $(TEMP_DIR)