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
Add support for multiarch e2e tests #845
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,23 +15,18 @@ PACKAGES_EXPANDED=$(PACKAGES:%=github.com/coreos/flannel/%) | |
|
||
# Set the (cross) compiler to use for different architectures | ||
ifeq ($(ARCH),amd64) | ||
LIB_DIR=/lib/x86_64-linux-gnu | ||
CC=gcc | ||
endif | ||
ifeq ($(ARCH),arm) | ||
LIB_DIR=/usr/arm-linux-gnueabihf/lib | ||
CC=arm-linux-gnueabihf-gcc | ||
endif | ||
ifeq ($(ARCH),arm64) | ||
LIB_DIR=/usr/aarch64-linux-gnu/lib | ||
CC=aarch64-linux-gnu-gcc | ||
endif | ||
ifeq ($(ARCH),ppc64le) | ||
LIB_DIR=/usr/powerpc64le-linux-gnu/lib | ||
CC=powerpc64le-linux-gnu-gcc | ||
endif | ||
ifeq ($(ARCH),s390x) | ||
LIB_DIR=/usr/s390x-linux-gnu/lib | ||
CC=s390x-linux-gnu-gcc | ||
endif | ||
|
||
|
@@ -55,9 +50,10 @@ test: license-check gofmt | |
# Run the functional tests | ||
make e2e-test | ||
|
||
e2e-test: bash_unit dist/flanneld-$(TAG)-$(ARCH).docker | ||
./bash_unit dist/functional-test.sh | ||
./bash_unit dist/functional-test-k8s.sh | ||
e2e-test: bash_unit dist/flanneld-e2e-$(TAG)-$(ARCH).docker | ||
$(MAKE) -C images/iperf3 ARCH=$(ARCH) | ||
FLANNEL_DOCKER_IMAGE=$(REGISTRY):$(TAG)-$(ARCH) ./bash_unit dist/functional-test.sh | ||
FLANNEL_DOCKER_IMAGE=$(REGISTRY):$(TAG)-$(ARCH) ./bash_unit dist/functional-test-k8s.sh | ||
|
||
cover: | ||
# A single package must be given - e.g. 'PACKAGES=pkg/ip make cover' | ||
|
@@ -101,6 +97,19 @@ ifeq ($(ARCH),amd64) | |
docker build -f Dockerfile.$(ARCH) -t $(REGISTRY):$(TAG) . | ||
endif | ||
|
||
# This will build flannel natively using golang image | ||
dist/flanneld-e2e-$(TAG)-$(ARCH).docker: | ||
# valid values for ARCH are [amd64 arm arm64 ppc64le s390x] | ||
docker run -e GOARM=$(GOARM) \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why you've added this? What was wrong with the |
||
-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 an ACI on disk for a specific arch and tag | ||
dist/flanneld-$(TAG)-$(ARCH).aci: dist/flanneld-$(TAG)-$(ARCH).docker | ||
docker2aci dist/flanneld-$(TAG)-$(ARCH).docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this depend on
dist/$(REGISTRY):$(TAG)-$(ARCH).docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between these 2 targets are:
dist/flanneld-$(TAG)-$(ARCH).docker uses
gcr.io/google_containers/kube-cross
which is not a multiarch image and can be run only onamd64
platform. And if I run this docker image on other than amd64 platform I'll hit exec format error.and dist/flanneld-e2e-$(TAG)-$(ARCH).docker target uses
golang:1.8.3
docker image which is multiarch image which will load the respective docker image while running on different architecture.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, that all makes sense.