Update nginx image, use docker buildx and remove qemu (#4923)

* Update nginx image, use docker buildx and remove qemu

* Update e2e image
This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-01-14 20:52:57 -03:00 committed by GitHub
parent e726f25d03
commit c8015c7734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 38 deletions

View file

@ -78,14 +78,7 @@ endif
GO111MODULE=off
# Set default base image dynamically for each arch
BASEIMAGE?=quay.io/kubernetes-ingress-controller/nginx-$(ARCH):422f554ba9cb291b4402306d77e218dff63ffab4
ifeq ($(ARCH),arm)
QEMUARCH=arm
endif
ifeq ($(ARCH),arm64)
QEMUARCH=aarch64
endif
BASEIMAGE?=quay.io/kubernetes-ingress-controller/nginx-$(ARCH):26f574dc279aa853736d7f7249965e90e47171d6
TEMP_DIR := $(shell mktemp -d)
DOCKERFILE := $(TEMP_DIR)/rootfs/Dockerfile
@ -122,29 +115,20 @@ container: clean-container .container-$(ARCH) ## Build image for a particular ar
cp -RP ./* $(TEMP_DIR)
$(SED_I) "s|BASEIMAGE|$(BASEIMAGE)|g" $(DOCKERFILE)
$(SED_I) "s|QEMUARCH|$(QEMUARCH)|g" $(DOCKERFILE)
$(SED_I) "s|VERSION|$(TAG)|g" $(DOCKERFILE)
ifeq ($(ARCH),amd64)
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
$(SED_I) "/CROSS_BUILD_/d" $(DOCKERFILE)
else
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/v4.1.1-1/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)/rootfs
$(SED_I) "s/CROSS_BUILD_//g" $(DOCKERFILE)
endif
echo "Building docker image..."
$(DOCKER) build --no-cache --pull -t $(MULTI_ARCH_IMAGE):$(TAG) $(TEMP_DIR)/rootfs
$(DOCKER) buildx build \
--no-cache \
--load \
--progress plain \
--platform linux/$(ARCH) \
-t $(MULTI_ARCH_IMAGE):$(TAG) $(TEMP_DIR)/rootfs
.PHONY: clean-container
clean-container: ## Removes local image
@$(DOCKER) rmi -f $(MULTI_ARCH_IMAGE):$(TAG) || true
.PHONY: register-qemu
register-qemu: ## Register /usr/bin/qemu-ARCH-static as the handler for binaries in multiple platforms
@$(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset >&2
.PHONY: push
push: .push-$(ARCH) ## Publish image for a particular arch.
@ -267,7 +251,7 @@ dep-ensure: check-go-version ## Update and vendo go dependencies.
.PHONY: dev-env
dev-env: check-go-version ## Starts a local Kubernetes cluster using minikube, building and deploying the ingress controller.
@USE_DOCKER=false build/dev-env.sh
@DIND_DOCKER=0 USE_DOCKER=false build/dev-env.sh
.PHONY: live-docs
live-docs: ## Build and launch a local copy of the documentation website in http://localhost:3000

View file

@ -30,7 +30,7 @@ function cleanup {
}
trap cleanup EXIT
E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v01042020-8fb2695d5
E2E_IMAGE=quay.io/kubernetes-ingress-controller/e2e:v01142020-3f0df1c35
DOCKER_OPTS=${DOCKER_OPTS:-}

View file

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM quay.io/kubernetes-ingress-controller/nginx-amd64:422f554ba9cb291b4402306d77e218dff63ffab4
FROM quay.io/kubernetes-ingress-controller/nginx-amd64:26f574dc279aa853736d7f7249965e90e47171d6
ARG GOLANG_VERSION
ARG GOLANG_SHA
@ -33,7 +33,6 @@ RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
RUN apk add --no-cache \
bash \
ca-certificates \
parallel \
wget \
make \
gcc \

View file

@ -14,15 +14,15 @@
TAG ?=v$(shell date +%m%d%Y)-$(shell git rev-parse --short HEAD)
REGISTRY ?= quay.io/kubernetes-ingress-controller
DOCKER ?= docker
IMAGE = $(REGISTRY)/e2e
all: docker-build docker-push
docker-build:
$(DOCKER) build \
docker build \
--pull \
--load \
--build-arg K8S_RELEASE=v1.15.7 \
--build-arg ETCD_VERSION=v3.3.18 \
--build-arg GOLANG_VERSION=1.13.5 \
@ -32,6 +32,6 @@ docker-build:
-t $(IMAGE):$(TAG) .
docker-push:
$(DOCKER) push $(IMAGE):$(TAG)
$(DOCKER) tag $(IMAGE):$(TAG) $(IMAGE):latest
$(DOCKER) push $(IMAGE):latest
docker push $(IMAGE):$(TAG)
docker tag $(IMAGE):$(TAG) $(IMAGE):latest
docker push $(IMAGE):latest

View file

@ -949,7 +949,7 @@ func buildOpentracing(input interface{}) string {
buf.WriteString("opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /etc/nginx/opentracing.json;")
}
} else if cfg.DatadogCollectorHost != "" {
buf.WriteString("opentracing_load_tracer /usr/local/lib/libdd_opentracing.so /etc/nginx/opentracing.json;")
buf.WriteString("opentracing_load_tracer /usr/local/lib64/libdd_opentracing.so /etc/nginx/opentracing.json;")
}
buf.WriteString("\r\n")

View file

@ -1184,7 +1184,7 @@ func TestBuildOpenTracing(t *testing.T) {
EnableOpentracing: true,
DatadogCollectorHost: "datadog-host.com",
}
expected = "opentracing_load_tracer /usr/local/lib/libdd_opentracing.so /etc/nginx/opentracing.json;\r\n"
expected = "opentracing_load_tracer /usr/local/lib64/libdd_opentracing.so /etc/nginx/opentracing.json;\r\n"
actual = buildOpentracing(cfgDatadog)
if expected != actual {

View file

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM BASEIMAGE
FROM --platform=$BUILDPLATFORM BASEIMAGE
LABEL org.opencontainers.image.title='NGINX Ingress Controller for Kubernetes'
LABEL org.opencontainers.image.documentation='https://kubernetes.github.io/ingress-nginx/'
@ -21,8 +21,6 @@ LABEL org.opencontainers.image.vendor='The Kubernetes Authors'
LABEL org.opencontainers.image.licenses='Apache-2.0'
LABEL org.opencontainers.image.version='VERSION'
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
WORKDIR /etc/nginx
RUN apk add -U --no-cache \

View file

@ -1,4 +1,4 @@
FROM quay.io/kubernetes-ingress-controller/e2e:v01042020-8fb2695d5 AS BASE
FROM quay.io/kubernetes-ingress-controller/e2e:v01142020-3f0df1c35 AS BASE
FROM alpine:3.11

View file

@ -43,6 +43,8 @@ export REGISTRY=ingress-controller
export K8S_VERSION=${K8S_VERSION:-v1.17.0}
export DOCKER_CLI_EXPERIMENTAL=enabled
KIND_CLUSTER_NAME="ingress-nginx-dev"
kind --version || $(echo "Please install kind before running e2e tests";exit 1)