Skip to content

Commit c85450c

Browse files
authored
Remove hard-coded names from e2e test and use local docker dependencies (#4502)
1 parent c7d2444 commit c85450c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+894
-293
lines changed

images/httpbin/Makefile

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
all: all-container
2+
3+
BUILDTAGS=
4+
5+
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
6+
TAG?=0.1
7+
REGISTRY?=kubernetes-ingress-controller
8+
GOOS?=linux
9+
DOCKER?=docker
10+
SED_I?=sed -i
11+
GOHOSTOS ?= $(shell go env GOHOSTOS)
12+
13+
ifeq ($(GOHOSTOS),darwin)
14+
SED_I=sed -i ''
15+
endif
16+
17+
REPO_INFO=$(shell git config --get remote.origin.url)
18+
19+
ARCH ?= $(shell go env GOARCH)
20+
GOARCH = ${ARCH}
21+
22+
# Set default base image dynamically for each arch
23+
BASEIMAGE?=quay.io/kubernetes-ingress-controller/debian-base-$(ARCH):0.1
24+
25+
ALL_ARCH = amd64 arm arm64
26+
27+
QEMUVERSION=v4.0.0
28+
29+
IMGNAME = httpbin
30+
IMAGE = $(REGISTRY)/$(IMGNAME)
31+
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
32+
33+
ifeq ($(ARCH),arm)
34+
QEMUARCH=arm
35+
endif
36+
ifeq ($(ARCH),arm64)
37+
QEMUARCH=aarch64
38+
endif
39+
ifeq ($(ARCH),ppc64le)
40+
QEMUARCH=ppc64le
41+
endif
42+
43+
TEMP_DIR := $(shell mktemp -d)
44+
45+
DOCKERFILE := $(TEMP_DIR)/rootfs/Dockerfile
46+
47+
sub-container-%:
48+
$(MAKE) ARCH=$* container
49+
50+
sub-push-%:
51+
$(MAKE) ARCH=$* push
52+
53+
all-container: $(addprefix sub-container-,$(ALL_ARCH))
54+
55+
all-push: $(addprefix sub-push-,$(ALL_ARCH))
56+
57+
container: .container-$(ARCH)
58+
.container-$(ARCH):
59+
cp -r ./* $(TEMP_DIR)
60+
$(SED_I) 's|BASEIMAGE|$(BASEIMAGE)|g' $(DOCKERFILE)
61+
$(SED_I) "s|QEMUARCH|$(QEMUARCH)|g" $(DOCKERFILE)
62+
63+
ifeq ($(ARCH),amd64)
64+
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
65+
$(SED_I) "/CROSS_BUILD_/d" $(DOCKERFILE)
66+
else
67+
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed
68+
# Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel
69+
# $(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset
70+
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)/rootfs
71+
$(SED_I) "s/CROSS_BUILD_//g" $(DOCKERFILE)
72+
endif
73+
74+
$(DOCKER) build -t $(MULTI_ARCH_IMG):$(TAG) $(TEMP_DIR)/rootfs
75+
76+
ifeq ($(ARCH), amd64)
77+
# This is for to maintain the backward compatibility
78+
$(DOCKER) tag $(MULTI_ARCH_IMG):$(TAG) $(IMAGE):$(TAG)
79+
endif
80+
81+
push: .push-$(ARCH)
82+
.push-$(ARCH):
83+
$(DOCKER) push $(MULTI_ARCH_IMG):$(TAG)
84+
ifeq ($(ARCH), amd64)
85+
$(DOCKER) push $(IMAGE):$(TAG)
86+
endif
87+
88+
clean:
89+
$(DOCKER) rmi -f $(MULTI_ARCH_IMG):$(TAG) || true
90+
91+
release: all-container all-push
92+
echo "done"
93+
94+
.PHONY: register-qemu
95+
register-qemu:
96+
# Register /usr/bin/qemu-ARCH-static as the handler for binaries in multiple platforms
97+
$(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset

images/httpbin/rootfs/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2019 The Kubernetes Authors. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM BASEIMAGE
16+
17+
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/
18+
19+
ENV LC_ALL=C.UTF-8
20+
ENV LANG=C.UTF-8
21+
22+
WORKDIR /httpbin
23+
24+
RUN clean-install python3-pip curl python3-pip git bash gcc libstdc++-8-dev libpython3.7-dev python3-setuptools \
25+
&& pip3 install --no-cache-dir httpbin \
26+
&& pip3 install --no-cache-dir gunicorn \
27+
&& pip3 install --no-cache-dir gevent \
28+
&& apt remove git gcc libstdc++-8-dev libpython3.7-dev python3-setuptools --yes
29+
30+
EXPOSE 80
31+
32+
CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]

test/e2e/annotations/affinity.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
5050
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
5151
}
5252

53-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
53+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
5454
f.EnsureIngress(ing)
5555

5656
f.WaitForNginxServer(host,
@@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
7676
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
7777
}
7878

79-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
79+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
8080
f.EnsureIngress(ing)
8181

8282
f.WaitForNginxServer(host,
@@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
116116
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
117117
}
118118

119-
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
119+
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, framework.EchoService, 80, &annotations)
120120
f.EnsureIngress(ing)
121121

122122
f.WaitForNginxServer(host,
@@ -158,14 +158,14 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
158158
{
159159
Path: "/something",
160160
Backend: extensions.IngressBackend{
161-
ServiceName: "http-svc",
161+
ServiceName: framework.EchoService,
162162
ServicePort: intstr.FromInt(80),
163163
},
164164
},
165165
{
166166
Path: "/somewhereelese",
167167
Backend: extensions.IngressBackend{
168-
ServiceName: "http-svc",
168+
ServiceName: framework.EchoService,
169169
ServicePort: intstr.FromInt(80),
170170
},
171171
},
@@ -211,7 +211,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
211211
"nginx.ingress.kubernetes.io/session-cookie-max-age": "259200",
212212
}
213213

214-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
214+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
215215
f.EnsureIngress(ing)
216216

217217
f.WaitForNginxServer(host,
@@ -247,7 +247,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
247247
"nginx.ingress.kubernetes.io/session-cookie-path": "/foo/bar",
248248
}
249249

250-
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
250+
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, &annotations)
251251
f.EnsureIngress(ing)
252252

253253
f.WaitForNginxServer(host,
@@ -275,7 +275,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
275275
"nginx.ingress.kubernetes.io/use-regex": "true",
276276
}
277277

278-
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
278+
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, framework.EchoService, 80, &annotations)
279279
f.EnsureIngress(ing)
280280

281281
f.WaitForNginxServer(host,
@@ -303,10 +303,10 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
303303
annotations := map[string]string{
304304
"nginx.ingress.kubernetes.io/affinity": "cookie",
305305
}
306-
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.Namespace, "http-svc", 80, &annotations)
306+
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.Namespace, framework.EchoService, 80, &annotations)
307307
f.EnsureIngress(ing1)
308308

309-
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
309+
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, framework.EchoService, 80, &map[string]string{})
310310
f.EnsureIngress(ing2)
311311

312312
f.WaitForNginxServer(host,

test/e2e/annotations/alias.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
4141
host := "foo"
4242
annotations := map[string]string{}
4343

44-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
44+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
4545
f.EnsureIngress(ing)
4646

4747
f.WaitForNginxServer(host,
@@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
7474
"nginx.ingress.kubernetes.io/server-alias": "bar",
7575
}
7676

77-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
77+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
7878
f.EnsureIngress(ing)
7979

8080
f.WaitForNginxServer(host,

test/e2e/annotations/approot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Approot", func() {
4343
"nginx.ingress.kubernetes.io/app-root": "/foo",
4444
}
4545

46-
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
46+
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, framework.EchoService, 80, &annotations)
4747
f.EnsureIngress(ing)
4848

4949
f.WaitForNginxServer(host,

0 commit comments

Comments
 (0)