Multi Arch test images

This commit is contained in:
Manjunath A Kumatagi
2017-06-12 14:37:12 +05:30
parent b84567a57e
commit 9b70ab1379
95 changed files with 449 additions and 480 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2016 The Kubernetes Authors. # Copyright 2017 The Kubernetes Authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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 # See the License for the specific language governing permissions and
# limitations under the License. # 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 ifndef WHAT
PREFIX = gcr.io/google_containers $(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: all-push: all-container
docker build --pull -t $(PREFIX)/hostexec:$(TAG) . ./image-util.sh push $(WHAT)
push: image .PHONY: all all-push all-container
gcloud docker -- push $(PREFIX)/hostexec:$(TAG)
clean:
rm -f hostexec

View File

@@ -0,0 +1,5 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox
s390x=s390x/busybox

View File

@@ -16,7 +16,7 @@ go_binary(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["main.go"], srcs = ["clusterapi-tester.go"],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/clientset_generated/internalclientset:go_default_library",

View File

@@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM busybox FROM BASEIMAGE
ADD main main ADD clusterapi-tester /clusterapi-tester
ENTRYPOINT ["/main"] ENTRYPOINT ["/clusterapi-tester"]

View File

@@ -12,20 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
all: push BIN=clusterapi-tester
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
# 0.0 shouldn't clobber any released builds bin:
TAG = 1.0 docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
PREFIX = gcr.io/google_containers/clusterapi-tester 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 .PHONY: bin
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

View File

@@ -0,0 +1 @@
clusterapi-tester

View File

@@ -0,0 +1 @@
1.1

View File

@@ -0,0 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6

View File

@@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM alpine FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apk add --no-cache bind-tools RUN apk add --no-cache bind-tools

View File

@@ -0,0 +1 @@
dnsutils

View File

@@ -0,0 +1 @@
1.1

View File

@@ -12,19 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = 0.1 BIN=ep
PREFIX = kubernetes 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 .PHONY: bin
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

View File

@@ -0,0 +1 @@
ep

View File

@@ -0,0 +1 @@
0.2

View File

@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
FROM scratch FROM scratch
ADD GITHASH.txt / COPY GITHASH.txt /
ADD gitserver / COPY fakegitserver /
ENTRYPOINT ["/gitserver"] ENTRYPOINT ["/fakegitserver"]

View File

@@ -12,21 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
.PHONY: all image push clean BIN=fakegitserver
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
TAG = 0.1 bin:
PREFIX = gcr.io/google_containers docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
IMAGE = fakegitserver golang:$(GOLANG_VERSION) \
ARCH = amd64 /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: .PHONY: bin
./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

View File

@@ -0,0 +1 @@
fakegitserver

View File

@@ -0,0 +1 @@
0.2

View File

@@ -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

View File

@@ -12,19 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = 0.1 BIN=goproxy
PREFIX = gcr.io/google_containers 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 .PHONY: bin
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

1
test/images/goproxy/NAME Normal file
View File

@@ -0,0 +1 @@
goproxy

View File

@@ -0,0 +1 @@
0.2

View File

@@ -0,0 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6

View File

@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM alpine:3.2 FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
# install necessary packages: # install necessary packages:
# - curl, nc: used by a lot of e2e tests # - curl, nc: used by a lot of e2e tests
# - iproute2: includes ss used in NodePort 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 # wait forever
CMD rm -f /fifo && mkfifo /fifo && exec cat </fifo CMD rm -f /fifo && mkfifo /fifo && exec cat </fifo

View File

@@ -0,0 +1 @@
hostexec

View File

@@ -0,0 +1 @@
1.3

112
test/images/image-util.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/bash
# 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.
# 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 -o errexit
set -o nounset
set -o pipefail
TASK=$1
IMAGE=$2
# Mapping of go ARCH to actual architectures shipped part of multiarch/qemu-user-static project
declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" )
# Returns list of all supported architectures from BASEIMAGE file
listArchs() {
cut -d "=" -f 1 ${IMAGE}/BASEIMAGE
}
# Returns baseimage need to used in Dockerfile for any given architecture
getBaseImage() {
arch=$1
echo $(grep "${arch}=" BASEIMAGE | cut -d= -f2)
}
# This function will build test image for all the architectures
# mentioned in BASEIMAGE file. In the absence of BASEIMAGE file,
# it will build for all the supported arch list - amd64, arm,
# arm64, ppc64le, s390x
build() {
if [[ -f ${IMAGE}/BASEIMAGE ]]; then
archs=$(listArchs)
else
archs=${!QEMUARCHS[@]}
fi
for arch in ${archs}; do
echo "Building image for ${IMAGE} ARCH: ${arch}..."
# Create a temporary directory for every architecture and copy the image content
# and build the image from temporary directory
temp_dir=$(mktemp -d)
cp -r ${IMAGE}/* ${temp_dir}
if [[ -f ${IMAGE}/Makefile ]]; then
# make bin will take care of all the prerequisites needed
# for building the docker image
make -C ${IMAGE} bin ARCH=${arch} TARGET=${temp_dir}
fi
pushd ${temp_dir}
# image tag
TAG=$(<VERSION)
# image name
IMAGENAME=$(<NAME)
if [[ -f BASEIMAGE ]]; then
BASEIMAGE=$(getBaseImage ${arch})
sed -i "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
fi
# copy the qemu-*-static binary to docker image to build the multi architecture image on x86 platform
if [[ $(grep "CROSS_BUILD_" Dockerfile) ]]; then
if [[ "${arch}" == "amd64" ]]; then
sed -i "/CROSS_BUILD_/d" Dockerfile
else
sed -i "s|QEMUARCH|${QEMUARCHS[$arch]}|g" Dockerfile
# Register qemu-*-static for all supported processors except the current one
docker run --rm --privileged multiarch/qemu-user-static:register --reset
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/${QEMUVERSION}/x86_64_qemu-${QEMUARCHS[$arch]}-static.tar.gz | tar -xz -C ${temp_dir}
sed -i "s/CROSS_BUILD_//g" Dockerfile
fi
fi
docker build --pull -t ${REGISTRY}/${IMAGENAME}-${arch}:${TAG} .
# Image without any arch postfix will point to amd64 by default.
if [[ "${arch}" == "amd64" ]]; then
docker tag ${REGISTRY}/${IMAGENAME}-${arch}:${TAG} ${REGISTRY}/${IMAGENAME}:${TAG}
fi
popd
done
}
# This function will push the docker images
push() {
if [[ -f ${IMAGE}/BASEIMAGE ]]; then
archs=$(listArchs)
else
archs=${!QEMUARCHS[@]}
fi
for arch in ${archs}; do
IMAGENAME=$(<${IMAGE}/NAME)
TAG=$(<${IMAGE}/VERSION)
gcloud docker -- push ${REGISTRY}/${IMAGENAME}-${arch}:${TAG}
if [[ "${arch}" == "amd64" ]]; then
gcloud docker -- push ${REGISTRY}/${IMAGENAME}:${TAG}
fi
done
}
eval ${TASK}

View File

@@ -0,0 +1,4 @@
amd64=gcr.io/google_containers/ubuntu-slim:0.12
arm=gcr.io/google_containers/ubuntu-slim-arm:0.12
arm64=gcr.io/google_containers/ubuntu-slim-arm64:0.12
ppc64le=gcr.io/google_containers/ubuntu-slim-ppc64le:0.12

View File

@@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM gcr.io/google_containers/ubuntu-slim:0.6 FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apt-get update && apt-get install -y --no-install-recommends iperf bash \ RUN apt-get update && apt-get install -y --no-install-recommends iperf bash \
&& apt-get clean -y \ && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \

View File

@@ -1,31 +0,0 @@
# 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.
TAG = e2e
PREFIX = gcr.io/google_containers
IMAGE = iperf
all: push
container: image
image:
docker build --pull -t $(PREFIX)/${IMAGE} . # Build new image and automatically tag it as latest
docker tag $(PREFIX)/${IMAGE} $(PREFIX)/${IMAGE}:$(TAG) # Add the version tag to the latest image
push: image
gcloud docker -- push $(PREFIX)/${IMAGE} # Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/${IMAGE}:$(TAG) # Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
clean:

1
test/images/iperf/NAME Normal file
View File

@@ -0,0 +1 @@
iperf

View File

@@ -0,0 +1 @@
0.1

View File

@@ -0,0 +1,4 @@
amd64=debian:jessie
arm=arm32v7/debian:jessie
arm64=arm64v8/debian:jessie
ppc64le=ppc64le/debian:jessie

View File

@@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM debian:jessie FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apt-get -q update && \ RUN apt-get -q update && \
apt-get install -y dnsutils && \ apt-get install -y dnsutils && \

View File

@@ -1,27 +0,0 @@
# 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.
# This image does not tag
#TAG =
PREFIX = gcr.io/google_containers
all: push
image:
docker build --pull -t $(PREFIX)/jessie-dnsutils .
push: image
gcloud docker -- push $(PREFIX)/jessie-dnsutils
clean:

View File

@@ -0,0 +1 @@
jessie-dnsutils

View File

@@ -0,0 +1 @@
0.1

View File

@@ -0,0 +1,4 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox

View File

@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM gcr.io/google_containers/ubuntu-slim:0.6 FROM BASEIMAGE
ENV LOGS_GENERATOR_LINES_TOTAL 1
ENV LOGS_GENERATOR_DURATION 1s
COPY logs-generator / COPY logs-generator /
CMD /logs-generator --logtostderr \ CMD ["sh", "-c", "/logs-generator --logtostderr --log-lines-total=${LOGS_GENERATOR_LINES_TOTAL} --run-duration=${LOGS_GENERATOR_DURATION}"]
--log-lines-total=${LOGS_GENERATOR_LINES_TOTAL} \
--run-duration=${LOGS_GENERATOR_DURATION}

View File

@@ -12,21 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = v0.1.1 BIN=logs-generator
PREFIX = gcr.io/google_containers ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
all: build 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/logs-generator && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
build: binary container .PHONY: bin
binary:
go build -a --ldflags '-w' -o logs-generator .
container:
docker build --pull -t $(PREFIX)/logs-generator:$(TAG) .
push:
gcloud docker -- push $(PREFIX)/logs-generator:$(TAG)
clean:
rm -f logs-generator

View File

@@ -0,0 +1 @@
logs-generator

View File

@@ -0,0 +1 @@
v0.1.2

View File

@@ -0,0 +1,5 @@
amd64=gcr.io/google_containers/mounttest-amd64:0.9
arm=gcr.io/google_containers/mounttest-arm:0.9
arm64=gcr.io/google_containers/mounttest-arm64:0.9
ppc64le=gcr.io/google_containers/mounttest-ppc64le:0.9
s390x=gcr.io/google_containers/mounttest-s390x:0.9

View File

@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM gcr.io/google_containers/mounttest:0.8 FROM BASEIMAGE
USER 1001 USER 1001

View File

@@ -1,26 +0,0 @@
# 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.
TAG = 0.5
PREFIX = gcr.io/google_containers
all: push
image:
sudo docker build --pull -t $(PREFIX)/mounttest-user:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/mounttest-user:$(TAG)
clean:

View File

@@ -0,0 +1 @@
mounttest-user

View File

@@ -0,0 +1 @@
0.6

View File

@@ -13,5 +13,5 @@
# limitations under the License. # limitations under the License.
FROM scratch FROM scratch
ADD mt mt COPY mounttest /
ENTRYPOINT ["/mt"] ENTRYPOINT ["/mounttest"]

View File

@@ -12,20 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = 0.8 BIN=mounttest
PREFIX = gcr.io/google_containers 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/mount-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
mt: mt.go .PHONY: bin
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./mt.go && \
chmod a+rx mt
image: mt
sudo docker build --pull -t $(PREFIX)/mounttest:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/mounttest:$(TAG)
clean:
rm -f mt

View File

@@ -0,0 +1 @@
mounttest

View File

@@ -0,0 +1 @@
0.9

View File

@@ -0,0 +1,5 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox
s390x=s390x/busybox

View File

@@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM busybox FROM BASEIMAGE
ADD server server COPY n-way-http /
ENTRYPOINT ["/server"] ENTRYPOINT ["/n-way-http"]

View File

@@ -12,20 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
all: push BIN=n-way-http
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
# 0.0 shouldn't clobber any released builds bin:
TAG = 0.0 docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
PREFIX = gcr.io/google_containers/n-way-http golang:$(GOLANG_VERSION) \
/bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/n-way-http && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
server: server.go .PHONY: bin
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -o server ./server.go
container: server
docker build --pull -t $(PREFIX):$(TAG) .
push: container
gcloud docker -- push $(PREFIX):$(TAG)
clean:
rm -f server

View File

@@ -0,0 +1 @@
n-way-http

View File

@@ -0,0 +1 @@
1.1

View File

@@ -0,0 +1,4 @@
amd64=alpine:3.6
arm=arm32v6/alpine:3.6
arm64=arm64v8/alpine:3.6
ppc64le=ppc64le/alpine:3.6

View File

@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM alpine FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
COPY net /net COPY net /net
RUN apk update && apk add curl RUN apk update && apk add curl

View File

@@ -12,28 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
ARCH := amd64 BIN=net
PREFIX ?= gcr.io/google_containers ARCH ?= amd64
TAG ?= 1.0 TARGET ?= $(CURDIR)
IMAGE ?= e2e-net-$(ARCH) GOLANG_VERSION ?= latest
SRCS := $(shell find . -name \*.go) 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/net && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
all: image .PHONY: bin
net: $(SRCS)
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w'
image: test net
docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/$(IMAGE):$(TAG)
clean:
rm -f net
test:
go test ./...
.PHONY: all clean image push test

1
test/images/net/NAME Normal file
View File

@@ -0,0 +1 @@
e2e-net

1
test/images/net/VERSION Normal file
View File

@@ -0,0 +1 @@
1.1

View File

@@ -0,0 +1,5 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox
s390x=s390x/busybox

View File

@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM busybox FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
ADD netexec netexec ADD netexec netexec
ADD netexec.go netexec.go
EXPOSE 8080 EXPOSE 8080
EXPOSE 8081 EXPOSE 8081

View File

@@ -12,22 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
.PHONY: all netexec image push clean BIN=netexec
ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
TAG = 1.7 bin:
PREFIX = gcr.io/google_containers 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/netexec && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
.PHONY: bin
all: push
netexec: netexec.go
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./netexec.go
image: netexec
docker build --pull -t $(PREFIX)/netexec:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/netexec:$(TAG)
clean:
rm -f netexec

1
test/images/netexec/NAME Normal file
View File

@@ -0,0 +1 @@
netexec

View File

@@ -0,0 +1 @@
1.8

View File

@@ -16,7 +16,7 @@ go_binary(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["webserver.go"], srcs = ["nettest.go"],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/client/clientset_generated/internalclientset:go_default_library", "//pkg/client/clientset_generated/internalclientset:go_default_library",

View File

@@ -13,6 +13,6 @@
# limitations under the License. # limitations under the License.
FROM scratch FROM scratch
ADD webserver webserver COPY nettest /
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["/webserver"] ENTRYPOINT ["/nettest"]

View File

@@ -12,21 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = 1.9 BIN=nettest
PREFIX = gcr.io/google_containers 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/network-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
webserver: webserver.go .PHONY: bin
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./webserver.go
container: image
image: webserver
docker build --pull -t $(PREFIX)/nettest:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/nettest:$(TAG)
clean:
rm -f webserver

View File

@@ -0,0 +1 @@
nettest

View File

@@ -0,0 +1 @@
2.0

View File

@@ -12,19 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = 1.2 BIN=portforwardtester
PREFIX = gcr.io/google_containers 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/port-forward-tester && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
portforwardtester: portforwardtester.go .PHONY: bin
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./portforwardtester.go
image: portforwardtester
docker build --pull -t $(PREFIX)/portforwardtester:$(TAG) .
push: image
gcloud docker -- push $(PREFIX)/portforwardtester:$(TAG)
clean:
rm -f portforwardtester

View File

@@ -0,0 +1 @@
portforwardtester

View File

@@ -0,0 +1 @@
1.3

View File

@@ -12,36 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Use: BIN=porter
# ARCH ?= amd64
# `make porter` will build porter. TARGET ?= $(CURDIR)
# `make tag` will suggest a tag. GOLANG_VERSION ?= latest
# `make image` will build an image-- you must supply a tag.
# `make push` will push the image-- you must supply a tag.
# This image does not tag in the normal way bin:
# TAG = docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
PREFIX = gcr.io/google_containers golang:$(GOLANG_VERSION) \
SUGGESTED_TAG = $(shell git rev-parse --verify HEAD) /bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/porter && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
porter: porter.go .PHONY: bin
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' ./porter.go
tag:
@echo "If all relevant changes are committed, suggest using TAG=$(SUGGESTED_TAG)"
@echo "$$ make container TAG=$(SUGGESTED_TAG)"
@echo "or"
@echo "$$ make push TAG=$(SUGGESTED_TAG)"
container: image
image:
$(if $(TAG),,$(error TAG is not defined. Use 'make tag' after committing changes to see a suggestion))
docker build --pull -t $(PREFIX)/porter:$(TAG) .
push:
$(if $(TAG),,$(error TAG is not defined. Use 'make tag' after committing changes to see a suggestion))
gcloud docker -- push $(PREFIX)/porter:$(TAG)
clean:
rm -f porter

1
test/images/porter/NAME Normal file
View File

@@ -0,0 +1 @@
porter

View File

@@ -0,0 +1 @@
0.1

View File

@@ -0,0 +1,3 @@
consumer
consume-cpu/consume-cpu
controller/controller

View File

@@ -0,0 +1,4 @@
amd64=gcr.io/google-containers/ubuntu-slim-amd64:0.12
arm=gcr.io/google-containers/ubuntu-slim-arm:0.12
arm64=gcr.io/google-containers/ubuntu-slim-arm64:0.12
ppc64le=gcr.io/google-containers/ubuntu-slim-ppc64le:0.12

View File

@@ -12,7 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM jess/stress FROM BASEIMAGE
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
RUN apt-get update && apt-get install -y --no-install-recommends stress && \
rm -rf /var/lib/apt/lists/*
ADD consumer /consumer ADD consumer /consumer
ADD consume-cpu /consume-cpu ADD consume-cpu /consume-cpu
EXPOSE 8080 EXPOSE 8080

View File

@@ -12,30 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
TAG = beta4 ARCH ?= amd64
PREFIX = gcr.io/google_containers TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
all: clean consumer 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/resource-consumer && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/consume-cpu/consume-cpu ./consume-cpu/consume_cpu.go && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/consumer ."
consumer: .PHONY: bin
CGO_ENABLED=0 go build -a -installsuffix cgo --ldflags '-w' -o consume-cpu/consume-cpu ./consume-cpu/consume_cpu.go
CGO_ENABLED=0 go build -a -installsuffix cgo --ldflags '-w' -o consumer .
CGO_ENABLED=0 go build -a -installsuffix cgo --ldflags '-w' -o controller/controller ./controller/controller.go
container: image
image:
sudo docker build --pull -t $(PREFIX)/resource_consumer:$(TAG) .
sudo docker build --pull -t $(PREFIX)/resource_consumer/controller:$(TAG) controller
run_container:
docker run --publish=8080:8080 $(PREFIX)/resource_consumer:$(TAG)
push:
gcloud docker -- push ${PREFIX}/resource_consumer:${TAG}
gcloud docker -- push ${PREFIX}/resource_consumer/controller:${TAG}
clean:
rm -f consumer
rm -f consume-cpu/consume-cpu
rm -f controller/controller

View File

@@ -0,0 +1 @@
resource_consumer

View File

@@ -0,0 +1 @@
0.1

View File

@@ -0,0 +1,5 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox
s390x=s390x/busybox

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM busybox FROM BASEIMAGE
ADD controller /controller ADD controller /controller
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["/controller"] ENTRYPOINT ["/controller"]

View File

@@ -1,4 +1,4 @@
# Copyright 2016 The Kubernetes Authors. # Copyright 2017 The Kubernetes Authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# This image does not tag BIN=controller
TAG ?= ARCH ?= amd64
PREFIX ?= gcr.io/google_containers TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
all: push bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../../:/go/src/k8s.io/kubernetes:Z \
image: golang:$(GOLANG_VERSION) \
docker build --pull -t $(PREFIX)/dnsutils . /bin/bash -c "\
cd /go/src/k8s.io/kubernetes/test/images/resource-consumer/controller && \
push: image CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
gcloud docker -- push $(PREFIX)/dnsutils
clean:

View File

@@ -0,0 +1 @@
resource_consumer/controller

View File

@@ -0,0 +1 @@
0.1

View File

@@ -0,0 +1,5 @@
amd64=busybox
arm=arm32v6/busybox
arm64=arm64v8/busybox
ppc64le=ppc64le/busybox
s390x=s390x/busybox

View File

@@ -13,6 +13,6 @@
# limitations under the License. # limitations under the License.
FROM BASEIMAGE FROM BASEIMAGE
ADD serve_hostname /serve_hostname COPY serve_hostname /
EXPOSE 9376 EXPOSE 9376
ENTRYPOINT ["/serve_hostname"] ENTRYPOINT ["/serve_hostname"]

View File

@@ -12,91 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Cross-build the serve_hostname image BIN=serve_hostname
#
# Usage:
# [TAG=v1.7] [PREFIX=gcr.io/google_containers] [TEST_REGISTRY=gcr.io/k8s-authenticated-test] [ARCH=amd64] [BASEIMAGE=busybox] make all
.PHONY: all push container clean
TAG ?= v1.7
REGISTRY ?= gcr.io/google-containers
TEST_REGISTRY ?= gcr.io/k8s-authenticated-test
# Architectures supported: amd64, arm, arm64, ppc64le and s390x
ARCH ?= amd64 ARCH ?= amd64
TARGET ?= $(CURDIR)
GOLANG_VERSION ?= latest
ALL_ARCH = amd64 arm arm64 ppc64le s390x bin:
docker run --rm -it -v $(TARGET):$(TARGET):Z -v `pwd`/../../../:/go/src/k8s.io/kubernetes:Z \
GOARM=7
TEMP_DIR := $(shell mktemp -d)
GOLANG_VERSION=1.8.3
BIN = serve_hostname
SRCS = serve_hostname.go
IMAGE = $(REGISTRY)/$(BIN)-$(ARCH)
TEST_IMAGE = $(TEST_REGISTRY)/$(BIN)-$(ARCH)
# Set default base image dynamically for each arch
ifeq ($(ARCH),amd64)
BASEIMAGE?=busybox
endif
ifeq ($(ARCH),arm)
BASEIMAGE?=armhf/busybox
endif
ifeq ($(ARCH),arm64)
BASEIMAGE?=aarch64/busybox
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE?=ppc64le/busybox
endif
ifeq ($(ARCH),s390x)
BASEIMAGE?=s390x/busybox
endif
# If you want to build AND push all containers, see the 'all-push' rule.
all: all-container
sub-container-%:
$(MAKE) ARCH=$* container
sub-push-%:
$(MAKE) ARCH=$* push
all-container: $(addprefix sub-container-,$(ALL_ARCH))
all-push: $(addprefix sub-push-,$(ALL_ARCH))
build: bin/$(BIN)-$(ARCH)
bin/$(BIN)-$(ARCH): $(SRCS)
# Copy the content in this dir to the temp dir
cp ./* $(TEMP_DIR)
docker run -it -v $(TEMP_DIR):/build \
golang:$(GOLANG_VERSION) \ golang:$(GOLANG_VERSION) \
/bin/bash -c "\ /bin/bash -c "\
cd /build && \ cd /go/src/k8s.io/kubernetes/test/images/serve_hostname && \
CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(BIN) ./$(SRCS)" CGO_ENABLED=0 GOARM=$(GOARM) GOARCH=$(ARCH) go build -a -installsuffix cgo --ldflags '-w' -o $(TARGET)/$(BIN) ."
container: .container-$(ARCH) .PHONY: bin
.container-$(ARCH): bin/$(BIN)-$(ARCH)
# Set the base image
cd $(TEMP_DIR) && sed -i.bak 's|BASEIMAGE|$(BASEIMAGE)|g' Dockerfile
docker build --pull -t $(IMAGE):$(TAG) $(TEMP_DIR)
if [ -n "$(TEST_REGISTRY)" ]; then \
docker tag $(IMAGE):$(TAG) $(TEST_IMAGE):$(TAG) ;\
fi
push: .push-$(ARCH)
.push-$(ARCH): .container-$(ARCH)
gcloud docker -- push $(IMAGE):$(TAG)
if [ -n "$(TEST_REGISTRY)" ]; then \
gcloud docker -- push $(TEST_IMAGE):$(TAG) ;\
fi
clean:
rm -rf $(BIN)

View File

@@ -0,0 +1 @@
serve_hostname

View File

@@ -0,0 +1 @@
v1.7