Build multi-arch images by default
This commit is contained in:
parent
0f20548386
commit
d250b97b43
18 changed files with 226 additions and 206 deletions
24
Makefile
24
Makefile
|
@ -76,21 +76,21 @@ help: ## Display this help
|
|||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
|
||||
# internal task
|
||||
.PHONY: sub-container-%
|
||||
sub-container-%:
|
||||
$(MAKE) ARCH=$* build container
|
||||
.PHONY: sub-image-%
|
||||
sub-image-%:
|
||||
$(MAKE) ARCH=$* build image
|
||||
|
||||
# internal task
|
||||
.PHONY: sub-push-%
|
||||
sub-push-%: ## Publish image for a particular arch.
|
||||
$(MAKE) ARCH=$* push
|
||||
|
||||
.PHONY: container
|
||||
container: clean-container .container-$(ARCH) ## Build image for a particular arch.
|
||||
.PHONY: image
|
||||
image: clean-image .image-$(ARCH) ## Build image for a particular arch.
|
||||
|
||||
# internal task to build image for a particular arch.
|
||||
.PHONY: .container-$(ARCH)
|
||||
.container-$(ARCH): init-docker-buildx
|
||||
.PHONY: .image-$(ARCH)
|
||||
.image-$(ARCH): init-docker-buildx
|
||||
mkdir -p $(TEMP_DIR)/rootfs
|
||||
cp bin/$(ARCH)/nginx-ingress-controller $(TEMP_DIR)/rootfs/nginx-ingress-controller
|
||||
cp bin/$(ARCH)/dbg $(TEMP_DIR)/rootfs/dbg
|
||||
|
@ -110,8 +110,8 @@ container: clean-container .container-$(ARCH) ## Build image for a particular ar
|
|||
--build-arg VERSION="$(TAG)" \
|
||||
-t $(REGISTRY)/nginx-ingress-controller-${ARCH}:$(TAG) $(TEMP_DIR)/rootfs
|
||||
|
||||
.PHONY: clean-container
|
||||
clean-container: ## Removes local image
|
||||
.PHONY: clean-image
|
||||
clean-image: ## Removes local image
|
||||
echo "removing old image $(BASE_IMAGE)-$(ARCH):$(TAG)"
|
||||
@docker rmi -f $(BASE_IMAGE)-$(ARCH):$(TAG) || true
|
||||
|
||||
|
@ -303,6 +303,6 @@ show-version:
|
|||
.PHONY: staging-gcr
|
||||
staging-gcr:
|
||||
echo "Building NGINX image..."
|
||||
ARCH=amd64 make build container push
|
||||
ARCH=arm make build container push
|
||||
ARCH=arm64 make build container push
|
||||
ARCH=amd64 make build image push
|
||||
ARCH=arm make build image push
|
||||
ARCH=arm64 make build image push
|
||||
|
|
|
@ -82,9 +82,9 @@ docker buildx use ingress-nginx --default --global
|
|||
export DIND_TASKS=0
|
||||
|
||||
echo "Building NGINX image..."
|
||||
ARCH=amd64 make build container push
|
||||
ARCH=arm make build container push
|
||||
ARCH=arm64 make build container push
|
||||
ARCH=amd64 make build image push
|
||||
ARCH=arm make build image push
|
||||
ARCH=arm64 make build image push
|
||||
|
||||
echo "Creating multi-arch images..."
|
||||
make push-manifest
|
||||
|
|
|
@ -34,7 +34,7 @@ function cleanup {
|
|||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v05262020-209405940c6
|
||||
E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v05312020-2a72fd981
|
||||
|
||||
DOCKER_OPTS=${DOCKER_OPTS:-}
|
||||
|
||||
|
|
|
@ -17,17 +17,27 @@
|
|||
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
|
||||
TAG ?= 0.0
|
||||
|
||||
HOSTARCH := $(shell uname -m | sed -e s/x86_64/amd64/ \
|
||||
-e s/s390x/s390x/ \
|
||||
-e s/armv7l/arm/ \
|
||||
-e s/aarch64.*/arm64/)
|
||||
|
||||
ifndef ARCH
|
||||
ARCH := $(HOSTARCH)
|
||||
endif
|
||||
ifeq ($(ARCH),)
|
||||
$(error mandatory variable ARCH is empty)
|
||||
endif
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
DOCKER ?= docker
|
||||
|
||||
IMGNAME = cfssl
|
||||
IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||
IMAGE = $(REGISTRY)/cfssl
|
||||
|
||||
container:
|
||||
$(DOCKER) buildx build \
|
||||
image:
|
||||
docker buildx build \
|
||||
--load \
|
||||
--platform linux/amd64 \
|
||||
--platform $(ARCH) \
|
||||
-t $(IMAGE):$(TAG) rootfs
|
||||
|
||||
clean:
|
||||
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
|
||||
docker rmi -f $(IMAGE):$(TAG) || true
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM alpine:3.11
|
||||
FROM alpine:3.12
|
||||
|
||||
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
|
||||
RUN apk add --no-cache \
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
TAG ?=v$(shell date +%m%d%Y)-$(shell git rev-parse --short HEAD)
|
||||
REGISTRY ?= quay.io/kubernetes-ingress-controller
|
||||
DOCKER ?= docker
|
||||
|
||||
IMAGE = $(REGISTRY)/e2e-prow
|
||||
|
||||
all: docker-build docker-push
|
||||
|
||||
docker-build:
|
||||
.PHONY: image
|
||||
image:
|
||||
$(DOCKER) buildx build \
|
||||
--pull \
|
||||
--load \
|
||||
--push \
|
||||
--platform amd64 \
|
||||
--build-arg K8S_RELEASE=v1.17.0 \
|
||||
--build-arg ETCD_VERSION=v3.3.18 \
|
||||
--build-arg KIND_VERSION=v0.8.0 \
|
||||
--build-arg GO_VERSION=1.14.2 \
|
||||
-t $(IMAGE):$(TAG) .
|
||||
|
||||
docker-push:
|
||||
$(DOCKER) push $(IMAGE):$(TAG)
|
||||
$(DOCKER) tag $(IMAGE):$(TAG) $(IMAGE):latest
|
||||
$(DOCKER) push $(IMAGE):latest
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM quay.io/kubernetes-ingress-controller/nginx-amd64:227f97465158f038b3c0a3bfd8299fe8d8a530e3
|
||||
FROM golang:1.14.3-alpine3.11 as GO
|
||||
|
||||
ARG GOLANG_VERSION
|
||||
ARG GOLANG_SHA
|
||||
FROM quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f
|
||||
|
||||
ARG RESTY_CLI_VERSION
|
||||
ARG RESTY_CLI_SHA
|
||||
|
@ -24,13 +23,10 @@ ARG K8S_RELEASE
|
|||
ARG ETCD_VERSION
|
||||
ARG CHART_TESTING_VERSION
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
||||
|
||||
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
|
||||
|
||||
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||
|
||||
COPY --from=GO /usr/local/go /usr/local/go
|
||||
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
ca-certificates \
|
||||
|
@ -43,84 +39,75 @@ RUN apk add --no-cache \
|
|||
python \
|
||||
py-crcmod \
|
||||
py-pip \
|
||||
unzip \
|
||||
openssl
|
||||
|
||||
RUN set -eux; \
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
g++ \
|
||||
pkgconfig \
|
||||
openssl \
|
||||
unzip \
|
||||
go \
|
||||
; \
|
||||
export \
|
||||
# set GOROOT_BOOTSTRAP such that we can actually build Go
|
||||
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
|
||||
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
|
||||
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
|
||||
GOOS="$(go env GOOS)" \
|
||||
GOARCH="$(go env GOARCH)" \
|
||||
GOHOSTOS="$(go env GOHOSTOS)" \
|
||||
GOHOSTARCH="$(go env GOHOSTARCH)" \
|
||||
; \
|
||||
# also explicitly set GO386 and GOARM if appropriate
|
||||
# https://github.com/docker-library/golang/issues/184
|
||||
apkArch="$(apk --print-arch)"; \
|
||||
case "$apkArch" in \
|
||||
armhf) export GOARM='6' ;; \
|
||||
armv7) export GOARM='7' ;; \
|
||||
x86) export GO386='387' ;; \
|
||||
esac; \
|
||||
\
|
||||
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
|
||||
echo "$GOLANG_SHA *go.tgz" | sha256sum -c -; \
|
||||
tar -C /usr/local -xzf go.tgz; \
|
||||
rm go.tgz; \
|
||||
\
|
||||
cd /usr/local/go/src; \
|
||||
./make.bash; \
|
||||
\
|
||||
rm -rf \
|
||||
# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
|
||||
/usr/local/go/pkg/bootstrap \
|
||||
# https://golang.org/cl/82095
|
||||
# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
|
||||
/usr/local/go/pkg/obj \
|
||||
; \
|
||||
\
|
||||
export PATH="/usr/local/go/bin:$PATH"; \
|
||||
go version \
|
||||
; \
|
||||
url="https://github.com/openresty/resty-cli/archive/v${RESTY_CLI_VERSION}.tar.gz"; \
|
||||
wget -O resty_cli.tgz "$url"; \
|
||||
echo "${RESTY_CLI_SHA} *resty_cli.tgz" | sha256sum -c -; \
|
||||
tar -C /tmp -xzf resty_cli.tgz; \
|
||||
rm resty_cli.tgz; \
|
||||
mv /tmp/resty-cli-${RESTY_CLI_VERSION}/bin/* /usr/local/bin/; \
|
||||
resty -V \
|
||||
; \
|
||||
luarocks install luacheck; \
|
||||
luarocks install busted \
|
||||
; \
|
||||
go get github.com/onsi/ginkgo/ginkgo; \
|
||||
go get golang.org/x/lint/golint \
|
||||
; \
|
||||
apk del .build-deps;
|
||||
ENV GOPATH /go
|
||||
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
||||
|
||||
RUN wget https://raw.githubusercontent.com/openresty/openresty-devel-utils/master/lj-releng -O /usr/local/bin/lj-releng \
|
||||
&& chmod +x /usr/local/bin/lj-releng
|
||||
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
|
||||
|
||||
RUN wget https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl \
|
||||
RUN go get github.com/onsi/ginkgo/ginkgo golang.org/x/lint/golint
|
||||
|
||||
RUN wget -O /tmp/resty_cli.tgz https://github.com/openresty/resty-cli/archive/v${RESTY_CLI_VERSION}.tar.gz \
|
||||
&& echo "${RESTY_CLI_SHA} */tmp/resty_cli.tgz" | sha256sum -c - \
|
||||
&& tar -C /tmp -xzf /tmp/resty_cli.tgz \
|
||||
&& mv /tmp/resty-cli-${RESTY_CLI_VERSION}/bin/* /usr/local/bin/ \
|
||||
&& resty -V \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
ARG LUA_CHECK_VERSION
|
||||
ARG LUA_CHECK_SHA
|
||||
|
||||
RUN wget -O /tmp/luarocks.tgz https://github.com/luarocks/luarocks/archive/v3.3.1.tar.gz \
|
||||
&& tar -C /tmp -xzf /tmp/luarocks.tgz \
|
||||
&& cd /tmp/luarocks* \
|
||||
&& ./configure \
|
||||
&& make install
|
||||
|
||||
RUN luarocks install busted \
|
||||
&& luarocks install luacheck
|
||||
|
||||
ARG BUSTED_VERSION
|
||||
ARG BUSTED_SHA
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN wget -O /usr/local/bin/kubectl \
|
||||
https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/${TARGETARCH}/kubectl \
|
||||
&& chmod +x /usr/local/bin/kubectl
|
||||
|
||||
RUN wget https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/amd64/kube-apiserver -O /usr/local/bin/kube-apiserver \
|
||||
RUN wget -O /usr/local/bin/kube-apiserver \
|
||||
https://storage.googleapis.com/kubernetes-release/release/${K8S_RELEASE}/bin/linux/${TARGETARCH}/kube-apiserver \
|
||||
&& chmod +x /usr/local/bin/kube-apiserver
|
||||
|
||||
RUN wget https://storage.googleapis.com/etcd/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-amd64.tar.gz -O /tmp/etcd-${ETCD_VERSION}-linux-amd64.tar.gz \
|
||||
RUN wget -O /tmp/etcd-${ETCD_VERSION}-linux-${TARGETARCH}.tar.gz \
|
||||
https://storage.googleapis.com/etcd/${ETCD_VERSION}/etcd-${ETCD_VERSION}-linux-${TARGETARCH}.tar.gz \
|
||||
&& mkdir -p /tmp/etcd-download \
|
||||
&& tar xzvf /tmp/etcd-${ETCD_VERSION}-linux-amd64.tar.gz -C /tmp/etcd-download --strip-components=1 \
|
||||
&& tar xzvf /tmp/etcd-${ETCD_VERSION}-linux-${TARGETARCH}.tar.gz -C /tmp/etcd-download --strip-components=1 \
|
||||
&& cp /tmp/etcd-download/etcd /usr/local/bin \
|
||||
&& rm -rf /tmp/etcd-download
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
RUN wget -O /tmp/ct-${CHART_TESTING_VERSION}-linux-amd64.tar.gz \
|
||||
https://github.com/helm/chart-testing/releases/download/v${CHART_TESTING_VERSION}/chart-testing_${CHART_TESTING_VERSION}_linux_amd64.tar.gz \
|
||||
&& mkdir -p /tmp/ct-download \
|
||||
&& tar xzvf /tmp/ct-${CHART_TESTING_VERSION}-linux-amd64.tar.gz -C /tmp/ct-download \
|
||||
&& rm /tmp/ct-${CHART_TESTING_VERSION}-linux-amd64.tar.gz \
|
||||
&& cp /tmp/ct-download/ct /usr/local/bin \
|
||||
&& mkdir -p /etc/ct \
|
||||
&& cp -R /tmp/ct-download/etc/* /etc/ct \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
ARG HELM_VERSION
|
||||
|
||||
RUN wget -O /tmp/helm.tgz https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz \
|
||||
&& tar -C /tmp -xzf /tmp/helm.tgz \
|
||||
&& cp /tmp/linux*/helm /usr/local/bin \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
RUN curl -sSL -o /usr/local/bin/cfssl https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssl_1.4.1_linux_${TARGETARCH} \
|
||||
&& curl -sSL -o /usr/local/bin/cfssljson https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssljson_1.4.1_linux_${TARGETARCH} \
|
||||
&& chmod +x /usr/local/bin/cfssl*
|
||||
|
||||
# Install a YAML Linter
|
||||
ARG YAML_LINT_VERSION
|
||||
|
@ -130,19 +117,4 @@ RUN pip install "yamllint==$YAML_LINT_VERSION"
|
|||
ARG YAMALE_VERSION
|
||||
RUN pip install "yamale==$YAMALE_VERSION"
|
||||
|
||||
RUN wget https://github.com/helm/chart-testing/releases/download/v${CHART_TESTING_VERSION}/chart-testing_${CHART_TESTING_VERSION}_linux_amd64.tar.gz \
|
||||
-O /tmp/ct-${CHART_TESTING_VERSION}-linux-amd64.tar.gz \
|
||||
&& mkdir -p /tmp/ct-download \
|
||||
&& tar xzvf /tmp/ct-${CHART_TESTING_VERSION}-linux-amd64.tar.gz -C /tmp/ct-download \
|
||||
&& cp /tmp/ct-download/ct /usr/local/bin \
|
||||
&& mkdir -p /etc/ct \
|
||||
&& cp -R /tmp/ct-download/etc/* /etc/ct \
|
||||
&& rm -rf /tmp/ct-download
|
||||
|
||||
RUN curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||
|
||||
RUN curl -sSL -o /usr/local/bin/cfssl https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssl_1.4.1_linux_amd64 \
|
||||
&& curl -sSL -o /usr/local/bin/cfssljson https://github.com/cloudflare/cfssl/releases/download/v1.4.1/cfssljson_1.4.1_linux_amd64 \
|
||||
&& chmod +x /usr/local/bin/cfssl*
|
||||
|
||||
WORKDIR $GOPATH
|
||||
|
|
|
@ -17,25 +17,24 @@ REGISTRY ?= quay.io/kubernetes-ingress-controller
|
|||
|
||||
IMAGE = $(REGISTRY)/e2e
|
||||
|
||||
all: docker-build docker-push
|
||||
PLATFORM ?= amd64
|
||||
|
||||
docker-build:
|
||||
.PHONY: image
|
||||
image:
|
||||
docker buildx build \
|
||||
--pull \
|
||||
--load \
|
||||
--progress plain \
|
||||
--platform $(PLATFORM) \
|
||||
--build-arg K8S_RELEASE=v1.15.7 \
|
||||
--build-arg ETCD_VERSION=v3.3.18 \
|
||||
--build-arg GOLANG_VERSION=1.14.3 \
|
||||
--build-arg GOLANG_SHA=93023778d4d1797b7bc6a53e86c3a9b150c923953225f8a48a2d5fabc971af56 \
|
||||
--build-arg RESTY_CLI_VERSION=0.25rc2 \
|
||||
--build-arg RESTY_CLI_SHA=a38d850441384fa037a5922ca012dcce8708d0e4abe34ad2fe4164a01b28bdfb \
|
||||
--build-arg CHART_TESTING_VERSION=3.0.0-beta.1 \
|
||||
--build-arg YAML_LINT_VERSION=1.13.0 \
|
||||
--build-arg YAMALE_VERSION=1.8.0 \
|
||||
--build-arg LUA_CHECK_VERSION=0.23.0 \
|
||||
--build-arg LUA_CHECK_SHA=b4edf3a7702519502696d4ac7372ed1bd6a82ded63bf81f2b1d7e9b37711be2b \
|
||||
--build-arg BUSTED_VERSION=v2.0.rc13-0 \
|
||||
--build-arg BUSTED_SHA=74ef88ae04545d78b4922e459c1cd459fb5a0356b73a061549d2e4601b5de254 \
|
||||
--build-arg HELM_VERSION=v3.2.0 \
|
||||
-t $(IMAGE):$(TAG) .
|
||||
|
||||
docker-push:
|
||||
docker push $(IMAGE):$(TAG)
|
||||
docker tag $(IMAGE):$(TAG) $(IMAGE):latest
|
||||
docker push $(IMAGE):latest
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
FROM openresty/openresty:1.15.8.2-alpine
|
||||
FROM quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f
|
||||
|
||||
RUN apk add -U perl curl \
|
||||
&& opm get bungle/lua-resty-template
|
||||
RUN apk add -U perl curl make unzip
|
||||
|
||||
COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
|
||||
RUN wget -O /tmp/luarocks.tgz https://github.com/luarocks/luarocks/archive/v3.3.1.tar.gz \
|
||||
&& tar -C /tmp -xzf /tmp/luarocks.tgz \
|
||||
&& cd /tmp/luarocks* \
|
||||
&& ./configure \
|
||||
&& make install \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
RUN luarocks install lua-resty-template
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
|
|
@ -17,17 +17,27 @@
|
|||
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
|
||||
TAG ?= 0.0
|
||||
|
||||
HOSTARCH := $(shell uname -m | sed -e s/x86_64/amd64/ \
|
||||
-e s/s390x/s390x/ \
|
||||
-e s/armv7l/arm/ \
|
||||
-e s/aarch64.*/arm64/)
|
||||
|
||||
ifndef ARCH
|
||||
ARCH := $(HOSTARCH)
|
||||
endif
|
||||
ifeq ($(ARCH),)
|
||||
$(error mandatory variable ARCH is empty)
|
||||
endif
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
DOCKER ?= docker
|
||||
|
||||
IMGNAME = echo
|
||||
IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||
IMAGE = $(REGISTRY)/echo
|
||||
|
||||
container:
|
||||
$(DOCKER) buildx build \
|
||||
image:
|
||||
docker buildx build \
|
||||
--load \
|
||||
--platform linux/amd64 \
|
||||
--platform $(ARCH) \
|
||||
-t $(IMAGE):$(TAG) .
|
||||
|
||||
clean:
|
||||
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
|
||||
docker rmi -f $(IMAGE):$(TAG) || true
|
||||
|
|
|
@ -4,8 +4,6 @@ env POD_NAME;
|
|||
env POD_NAMESPACE;
|
||||
env POD_IP;
|
||||
|
||||
daemon off;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
|
|
@ -17,24 +17,33 @@
|
|||
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
|
||||
TAG ?= 0.0
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
DOCKER ?= docker
|
||||
HOSTARCH := $(shell uname -m | sed -e s/x86_64/amd64/ \
|
||||
-e s/s390x/s390x/ \
|
||||
-e s/armv7l/arm/ \
|
||||
-e s/aarch64.*/arm64/)
|
||||
|
||||
IMGNAME = fastcgi-helloserver
|
||||
IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||
ifndef ARCH
|
||||
ARCH := $(HOSTARCH)
|
||||
endif
|
||||
ifeq ($(ARCH),)
|
||||
$(error mandatory variable ARCH is empty)
|
||||
endif
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
|
||||
IMAGE = $(REGISTRY)/fastcgi-helloserver
|
||||
|
||||
PKG=k8s.io/ingress-nginx/images/fastcgi-helloserver
|
||||
|
||||
container: clean build
|
||||
$(DOCKER) buildx build \
|
||||
.PHONY: image
|
||||
image: build
|
||||
docker buildx build \
|
||||
--load \
|
||||
--platform linux/amd64 \
|
||||
--platform $(ARCH) \
|
||||
-t $(IMAGE):$(TAG) rootfs
|
||||
|
||||
build: clean
|
||||
CGO_ENABLED=0 go build -a -installsuffix cgo \
|
||||
.PHONY: build
|
||||
build:
|
||||
GOARCH=$(ARCH) CGO_ENABLED=0 go build -a -installsuffix cgo \
|
||||
-ldflags "-s -w" \
|
||||
-o rootfs/fastcgi-helloserver ${PKG}/...
|
||||
|
||||
clean:
|
||||
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM us.gcr.io/k8s-artifacts-prod/build-image/debian-base-amd64:v2.1.0
|
||||
FROM scratch
|
||||
|
||||
COPY . /
|
||||
|
||||
|
|
|
@ -17,17 +17,25 @@
|
|||
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
|
||||
TAG ?= 0.0
|
||||
|
||||
HOSTARCH := $(shell uname -m | sed -e s/x86_64/amd64/ \
|
||||
-e s/s390x/s390x/ \
|
||||
-e s/armv7l/arm/ \
|
||||
-e s/aarch64.*/arm64/)
|
||||
|
||||
ifndef ARCH
|
||||
ARCH := $(HOSTARCH)
|
||||
endif
|
||||
ifeq ($(ARCH),)
|
||||
$(error mandatory variable ARCH is empty)
|
||||
endif
|
||||
|
||||
REGISTRY ?= ingress-controller
|
||||
DOCKER ?= docker
|
||||
|
||||
IMGNAME = httpbin
|
||||
IMAGE = $(REGISTRY)/$(IMGNAME)
|
||||
IMAGE = $(REGISTRY)/httpbin
|
||||
|
||||
container:
|
||||
$(DOCKER) buildx build \
|
||||
.PHONY: image
|
||||
image:
|
||||
docker buildx build \
|
||||
--load \
|
||||
--platform linux/amd64 \
|
||||
--platform $(ARCH) \
|
||||
-t $(IMAGE):$(TAG) rootfs
|
||||
|
||||
clean:
|
||||
$(DOCKER) rmi -f $(IMAGE):$(TAG) || true
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM alpine:3.11
|
||||
FROM alpine:3.12
|
||||
|
||||
ENV LC_ALL=C.UTF-8
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
|
||||
&& apk update \
|
||||
&& apk add --no-cache \
|
||||
python3 python3-dev \
|
||||
musl-dev gcc g++ make \
|
||||
libffi libffi-dev libstdc++ \
|
||||
py3-gevent py3-gunicorn py3-wheel@edge \
|
||||
RUN apk update \
|
||||
&& apk add --no-cache \
|
||||
python3 python3-dev \
|
||||
musl-dev gcc g++ make \
|
||||
libffi libffi-dev libstdc++ \
|
||||
py3-gevent py3-gunicorn py3-wheel \
|
||||
py3-pip \
|
||||
&& pip3 install httpbin \
|
||||
&& apk del python3-dev musl-dev gcc g++ make libffi-dev
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FROM quay.io/kubernetes-ingress-controller/e2e:v05262020-209405940c6 AS BASE
|
||||
FROM quay.io/kubernetes-ingress-controller/e2e:v05312020-2a72fd981 AS BASE
|
||||
|
||||
FROM alpine:3.11
|
||||
FROM alpine:3.12
|
||||
|
||||
RUN apk add -U --no-cache \
|
||||
ca-certificates \
|
||||
|
@ -10,11 +10,10 @@ RUN apk add -U --no-cache \
|
|||
libc6-compat \
|
||||
openssl
|
||||
|
||||
RUN curl -sSL https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||
|
||||
COPY --from=BASE /go/bin/ginkgo /usr/local/bin/
|
||||
COPY --from=BASE /usr/local/bin/kubectl /usr/local/bin/
|
||||
COPY --from=BASE /usr/local/bin/cfssl /usr/local/bin/
|
||||
COPY --from=BASE /usr/local/bin/helm /usr/local/bin/
|
||||
COPY --from=BASE /usr/local/bin/cfssljson /usr/local/bin/
|
||||
|
||||
COPY . /
|
||||
|
|
|
@ -53,9 +53,7 @@ func (f *Framework) NewEchoDeploymentWithReplicas(replicas int) {
|
|||
// name is configurable
|
||||
func (f *Framework) NewEchoDeploymentWithNameAndReplicas(name string, replicas int) {
|
||||
deployment := newDeployment(name, f.Namespace, "ingress-controller/echo:1.0.0-dev", 80, int32(replicas),
|
||||
[]string{
|
||||
"openresty",
|
||||
},
|
||||
nil,
|
||||
[]corev1.VolumeMount{},
|
||||
[]corev1.Volume{},
|
||||
)
|
||||
|
@ -91,21 +89,35 @@ func (f *Framework) NewEchoDeploymentWithNameAndReplicas(name string, replicas i
|
|||
// NewSlowEchoDeployment creates a new deployment of the slow echo server image in a particular namespace.
|
||||
func (f *Framework) NewSlowEchoDeployment() {
|
||||
data := map[string]string{}
|
||||
data["default.conf"] = `#
|
||||
data["nginx.conf"] = `#
|
||||
|
||||
server {
|
||||
access_log on;
|
||||
access_log /dev/stdout;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
listen 80;
|
||||
http {
|
||||
default_type 'text/plain';
|
||||
client_max_body_size 0;
|
||||
|
||||
location / {
|
||||
echo ok;
|
||||
}
|
||||
server {
|
||||
access_log on;
|
||||
access_log /dev/stdout;
|
||||
|
||||
location ~ ^/sleep/(?<sleepTime>[0-9]+)$ {
|
||||
echo_sleep $sleepTime;
|
||||
echo "ok after $sleepTime seconds";
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
content_by_lua_block {
|
||||
ngx.print("ok")
|
||||
}
|
||||
}
|
||||
|
||||
location ~ ^/sleep/(?<sleepTime>[0-9]+)$ {
|
||||
content_by_lua_block {
|
||||
ngx.sleep(ngx.var.sleepTime)
|
||||
ngx.print("ok after " .. ngx.var.sleepTime .. " seconds")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,12 +132,13 @@ server {
|
|||
}, metav1.CreateOptions{})
|
||||
assert.Nil(ginkgo.GinkgoT(), err, "creating configmap")
|
||||
|
||||
deployment := newDeployment(SlowEchoService, f.Namespace, "openresty/openresty:1.15.8.2-alpine", 80, 1,
|
||||
deployment := newDeployment(SlowEchoService, f.Namespace, "quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f", 80, 1,
|
||||
nil,
|
||||
[]corev1.VolumeMount{
|
||||
{
|
||||
Name: SlowEchoService,
|
||||
MountPath: "/etc/nginx/conf.d",
|
||||
MountPath: "/etc/nginx/nginx.conf",
|
||||
SubPath: "nginx.conf",
|
||||
ReadOnly: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -78,15 +78,15 @@ kind create cluster \
|
|||
echo "Kubernetes cluster:"
|
||||
kubectl get nodes -o wide
|
||||
|
||||
echo "[dev-env] building container"
|
||||
echo "[dev-env] building image"
|
||||
export EXIT_CODE=-1
|
||||
echo "
|
||||
make -C ${DIR}/../../ build container
|
||||
make -C ${DIR}/../../ build image
|
||||
make -C ${DIR}/../../ e2e-test-image
|
||||
make -C ${DIR}/../../images/fastcgi-helloserver/ GO111MODULE=\"on\" build container
|
||||
make -C ${DIR}/../../images/echo/ container
|
||||
make -C ${DIR}/../../images/httpbin/ container
|
||||
make -C ${DIR}/../../images/cfssl/ container
|
||||
make -C ${DIR}/../../images/fastcgi-helloserver/ GO111MODULE=\"on\" build image
|
||||
make -C ${DIR}/../../images/httpbin/ image
|
||||
make -C ${DIR}/../../images/echo/ image
|
||||
make -C ${DIR}/../../images/cfssl/ image
|
||||
" | parallel --joblog /tmp/log {} || EXIT_CODE=$?
|
||||
if [ ${EXIT_CODE} -eq 0 ] || [ ${EXIT_CODE} -eq -1 ];
|
||||
then
|
||||
|
@ -102,8 +102,8 @@ fi
|
|||
docker tag ${REGISTRY}/nginx-ingress-controller-${ARCH}:${TAG} ${REGISTRY}/nginx-ingress-controller:${TAG}
|
||||
|
||||
# Preload images used in e2e tests
|
||||
docker pull openresty/openresty:1.15.8.2-alpine
|
||||
docker pull moul/grpcbin
|
||||
docker pull quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f
|
||||
|
||||
KIND_WORKERS=$(kind get nodes --name="${KIND_CLUSTER_NAME}" | grep worker | awk '{printf (NR>1?",":"") $1}')
|
||||
|
||||
|
@ -113,9 +113,9 @@ echo "
|
|||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} nginx-ingress-controller:e2e
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/nginx-ingress-controller:${TAG}
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/fastcgi-helloserver:${TAG}
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} openresty/openresty:1.15.8.2-alpine
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/httpbin:${TAG}
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/echo:${TAG}
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} quay.io/kubernetes-ingress-controller/nginx:e3c49c52f4b74fe47ad65d6f3266a02e8b6b622f
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} moul/grpcbin
|
||||
kind load docker-image --name="${KIND_CLUSTER_NAME}" --nodes=${KIND_WORKERS} ${REGISTRY}/cfssl:${TAG}
|
||||
" | parallel --joblog /tmp/log {} || EXIT_CODE=$?
|
||||
|
|
Loading…
Reference in a new issue