diff --git a/test/images/hostexec/Makefile b/test/images/Makefile similarity index 53% rename from test/images/hostexec/Makefile rename to test/images/Makefile index 04b4008e4c2..9d5aeb5ebc5 100644 --- a/test/images/hostexec/Makefile +++ b/test/images/Makefile @@ -1,4 +1,4 @@ -# Copyright 2016 The Kubernetes Authors. +# Copyright 2017 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,19 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -.PHONY: all image push clean +REGISTRY ?= gcr.io/k8s-e2e-images +GOARM=7 +QEMUVERSION=v2.7.0 +GOLANG_VERSION=1.8.3 +export -TAG = 1.2 -PREFIX = gcr.io/google_containers +ifndef WHAT +$(error WHAT is a required variable, ex: make all WHAT=net) +endif +# Build code. +# +# Args: +# WHAT: Directory names to build. +# +# Example: +# make all WHAT=clusterapi-tester +all: all-container -all: push +all-container: + ./image-util.sh build $(WHAT) -image: - docker build --pull -t $(PREFIX)/hostexec:$(TAG) . +all-push: all-container + ./image-util.sh push $(WHAT) -push: image - gcloud docker -- push $(PREFIX)/hostexec:$(TAG) - -clean: - rm -f hostexec +.PHONY: all all-push all-container diff --git a/test/images/clusterapi-tester/BASEIMAGE b/test/images/clusterapi-tester/BASEIMAGE new file mode 100644 index 00000000000..44329aaa5b1 --- /dev/null +++ b/test/images/clusterapi-tester/BASEIMAGE @@ -0,0 +1,5 @@ +amd64=busybox +arm=arm32v6/busybox +arm64=arm64v8/busybox +ppc64le=ppc64le/busybox +s390x=s390x/busybox diff --git a/test/images/clusterapi-tester/BUILD b/test/images/clusterapi-tester/BUILD index 2e20ac80d0e..98c5c2c528c 100644 --- a/test/images/clusterapi-tester/BUILD +++ b/test/images/clusterapi-tester/BUILD @@ -16,7 +16,7 @@ go_binary( go_library( name = "go_default_library", - srcs = ["main.go"], + srcs = ["clusterapi-tester.go"], tags = ["automanaged"], deps = [ "//pkg/client/clientset_generated/internalclientset:go_default_library", diff --git a/test/images/clusterapi-tester/Dockerfile b/test/images/clusterapi-tester/Dockerfile index 9327d227545..cfb8401d859 100644 --- a/test/images/clusterapi-tester/Dockerfile +++ b/test/images/clusterapi-tester/Dockerfile @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM busybox -ADD main main -ENTRYPOINT ["/main"] +FROM BASEIMAGE +ADD clusterapi-tester /clusterapi-tester +ENTRYPOINT ["/clusterapi-tester"] diff --git a/test/images/clusterapi-tester/Makefile b/test/images/clusterapi-tester/Makefile index 02a0e5616b6..369c5cad87e 100644 --- a/test/images/clusterapi-tester/Makefile +++ b/test/images/clusterapi-tester/Makefile @@ -12,20 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -all: push +BIN=clusterapi-tester +ARCH ?= amd64 +TARGET ?= $(CURDIR) +GOLANG_VERSION ?= latest -# 0.0 shouldn't clobber any released builds -TAG = 1.0 -PREFIX = gcr.io/google_containers/clusterapi-tester +bin: + docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \ + golang:$(GOLANG_VERSION) \ + /bin/bash -c "\ + cd /go/src/k8s.io/kubernetes/test/images/clusterapi-tester && \ + CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN)" -main: main.go - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -o main ./main.go - -container: main - docker build --pull -t $(PREFIX):$(TAG) . - -push: container - gcloud docker -- push $(PREFIX):$(TAG) - -clean: - rm -f main +.PHONY: bin diff --git a/test/images/clusterapi-tester/NAME b/test/images/clusterapi-tester/NAME new file mode 100644 index 00000000000..97185c48995 --- /dev/null +++ b/test/images/clusterapi-tester/NAME @@ -0,0 +1 @@ +clusterapi-tester diff --git a/test/images/clusterapi-tester/VERSION b/test/images/clusterapi-tester/VERSION new file mode 100644 index 00000000000..9459d4ba2a0 --- /dev/null +++ b/test/images/clusterapi-tester/VERSION @@ -0,0 +1 @@ +1.1 diff --git a/test/images/clusterapi-tester/main.go b/test/images/clusterapi-tester/clusterapi-tester.go similarity index 100% rename from test/images/clusterapi-tester/main.go rename to test/images/clusterapi-tester/clusterapi-tester.go diff --git a/test/images/dnsutils/BASEIMAGE b/test/images/dnsutils/BASEIMAGE new file mode 100644 index 00000000000..114844f395e --- /dev/null +++ b/test/images/dnsutils/BASEIMAGE @@ -0,0 +1,4 @@ +amd64=alpine:3.6 +arm=arm32v6/alpine:3.6 +arm64=arm64v8/alpine:3.6 +ppc64le=ppc64le/alpine:3.6 diff --git a/test/images/dnsutils/Dockerfile b/test/images/dnsutils/Dockerfile index 2d037e9f843..d041c62703f 100644 --- a/test/images/dnsutils/Dockerfile +++ b/test/images/dnsutils/Dockerfile @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine +FROM BASEIMAGE + +CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ RUN apk add --no-cache bind-tools diff --git a/test/images/dnsutils/NAME b/test/images/dnsutils/NAME new file mode 100644 index 00000000000..bca3eb0f23f --- /dev/null +++ b/test/images/dnsutils/NAME @@ -0,0 +1 @@ +dnsutils diff --git a/test/images/dnsutils/VERSION b/test/images/dnsutils/VERSION new file mode 100644 index 00000000000..9459d4ba2a0 --- /dev/null +++ b/test/images/dnsutils/VERSION @@ -0,0 +1 @@ +1.1 diff --git a/test/images/entrypoint-tester/Makefile b/test/images/entrypoint-tester/Makefile index a15e6670582..9d7c516fae6 100644 --- a/test/images/entrypoint-tester/Makefile +++ b/test/images/entrypoint-tester/Makefile @@ -12,19 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -TAG = 0.1 -PREFIX = kubernetes +BIN=ep +ARCH ?= amd64 +TARGET ?= $(CURDIR) +GOLANG_VERSION ?= latest -all: push +bin: + docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \ + golang:$(GOLANG_VERSION) \ + /bin/bash -c "\ + cd /go/src/k8s.io/kubernetes/test/images/entrypoint-tester && \ + CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ." -ep: ep.go - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./ep.go - -image: ep - sudo docker build --pull -t $(PREFIX)/eptest:$(TAG) . - -push: image - sudo docker push $(PREFIX)/eptest:$(TAG) - -clean: - rm -f ep +.PHONY: bin diff --git a/test/images/entrypoint-tester/NAME b/test/images/entrypoint-tester/NAME new file mode 100644 index 00000000000..e2d8e243c18 --- /dev/null +++ b/test/images/entrypoint-tester/NAME @@ -0,0 +1 @@ +ep diff --git a/test/images/entrypoint-tester/VERSION b/test/images/entrypoint-tester/VERSION new file mode 100644 index 00000000000..3b04cfb60da --- /dev/null +++ b/test/images/entrypoint-tester/VERSION @@ -0,0 +1 @@ +0.2 diff --git a/test/images/fakegitserver/Dockerfile b/test/images/fakegitserver/Dockerfile index 8ec3654f010..e25b13e1d6a 100644 --- a/test/images/fakegitserver/Dockerfile +++ b/test/images/fakegitserver/Dockerfile @@ -13,6 +13,7 @@ # limitations under the License. FROM scratch -ADD GITHASH.txt / -ADD gitserver / -ENTRYPOINT ["/gitserver"] +COPY GITHASH.txt / +COPY fakegitserver / +ENTRYPOINT ["/fakegitserver"] + diff --git a/test/images/fakegitserver/Makefile b/test/images/fakegitserver/Makefile index 98b19cfb1c7..b99b9e049f2 100644 --- a/test/images/fakegitserver/Makefile +++ b/test/images/fakegitserver/Makefile @@ -12,21 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -.PHONY: all image push clean +BIN=fakegitserver +ARCH ?= amd64 +TARGET ?= $(CURDIR) +GOLANG_VERSION ?= latest -TAG = 0.1 -PREFIX = gcr.io/google_containers -IMAGE = fakegitserver -ARCH = amd64 +bin: + docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \ + golang:$(GOLANG_VERSION) \ + /bin/bash -c "\ + cd /go/src/k8s.io/kubernetes/test/images/fakegitserver && \ + CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ." + @echo $(shell git rev-parse HEAD) > $(TARGET)/GITHASH.txt -image: - ./prepare.sh $(ARCH) - docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) . - -push: image - gcloud docker -- push $(PREFIX)/$(IMAGE):$(TAG) - -all: push - -clean: - rm -f gitserver GITHASH.txt +.PHONY: bin diff --git a/test/images/fakegitserver/NAME b/test/images/fakegitserver/NAME new file mode 100644 index 00000000000..1f1e4b248bf --- /dev/null +++ b/test/images/fakegitserver/NAME @@ -0,0 +1 @@ +fakegitserver diff --git a/test/images/fakegitserver/VERSION b/test/images/fakegitserver/VERSION new file mode 100644 index 00000000000..3b04cfb60da --- /dev/null +++ b/test/images/fakegitserver/VERSION @@ -0,0 +1 @@ +0.2 diff --git a/test/images/fakegitserver/prepare.sh b/test/images/fakegitserver/prepare.sh deleted file mode 100755 index 414e0447974..00000000000 --- a/test/images/fakegitserver/prepare.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e -set -x - -ARCH=$1 - -# Build the binary. -CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -installsuffix cgo -ldflags '-w' ./gitserver.go - -# Write down the current commit hash. -echo $(git rev-parse HEAD) >> GITHASH.txt diff --git a/test/images/goproxy/Makefile b/test/images/goproxy/Makefile index f7408cbd95d..ce0b1bcaa58 100644 --- a/test/images/goproxy/Makefile +++ b/test/images/goproxy/Makefile @@ -12,19 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -TAG = 0.1 -PREFIX = gcr.io/google_containers +BIN=goproxy +ARCH ?= amd64 +TARGET ?= $(CURDIR) +GOLANG_VERSION ?= latest -all: push +bin: + docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \ + golang:$(GOLANG_VERSION) \ + /bin/bash -c "\ + cd /go/src/k8s.io/kubernetes/test/images/goproxy && \ + CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ." -goproxy: goproxy.go - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./goproxy.go - -image: goproxy - docker build --pull -t $(PREFIX)/goproxy:$(TAG) . - -push: image - gcloud docker -- push $(PREFIX)/goproxy:$(TAG) - -clean: - rm -f goproxy +.PHONY: bin diff --git a/test/images/goproxy/NAME b/test/images/goproxy/NAME new file mode 100644 index 00000000000..663e1754bde --- /dev/null +++ b/test/images/goproxy/NAME @@ -0,0 +1 @@ +goproxy diff --git a/test/images/goproxy/VERSION b/test/images/goproxy/VERSION new file mode 100644 index 00000000000..3b04cfb60da --- /dev/null +++ b/test/images/goproxy/VERSION @@ -0,0 +1 @@ +0.2 diff --git a/test/images/hostexec/BASEIMAGE b/test/images/hostexec/BASEIMAGE new file mode 100644 index 00000000000..114844f395e --- /dev/null +++ b/test/images/hostexec/BASEIMAGE @@ -0,0 +1,4 @@ +amd64=alpine:3.6 +arm=arm32v6/alpine:3.6 +arm64=arm64v8/alpine:3.6 +ppc64le=ppc64le/alpine:3.6 diff --git a/test/images/hostexec/Dockerfile b/test/images/hostexec/Dockerfile index 98f2565f7c2..af6a4cb6181 100644 --- a/test/images/hostexec/Dockerfile +++ b/test/images/hostexec/Dockerfile @@ -12,12 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.2 +FROM BASEIMAGE + +CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ # install necessary packages: # - curl, nc: used by a lot of e2e tests # - iproute2: includes ss used in NodePort tests -run apk --update add curl netcat-openbsd iproute2 && rm -rf /var/cache/apk/* +RUN apk --update add curl netcat-openbsd iproute2 && rm -rf /var/cache/apk/* # wait forever CMD rm -f /fifo && mkfifo /fifo && exec cat