Refactor e2e tests to use the service ClusterIP
This commit is contained in:
parent
f04361cc06
commit
5e249d3366
80 changed files with 777 additions and 706 deletions
105
.travis.yml
105
.travis.yml
|
@ -22,59 +22,58 @@ notifications:
|
||||||
# New secure variables can be added using travis encrypt -r kubernetes/ingress-nginx --add K=V
|
# New secure variables can be added using travis encrypt -r kubernetes/ingress-nginx --add K=V
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- DOCKER=docker
|
- DOCKER=docker
|
||||||
- SKIP_SNAPSHOT=true
|
- SKIP_SNAPSHOT=true
|
||||||
- NODE_IP=10.192.0.3
|
- GH_REF=github.com/kubernetes/ingress-nginx
|
||||||
- E2E_NODES=6
|
- secure: LIS2XpZufWTcJ53jiRsSZy2Gi1EUJ1XmLg7z3f2ZHeMnyG2Jhk3GW4vod1FNru+PY4PWgddLdCdIl+jqOYXndFlbdAWF3/Oy5fEkYLXdYV7tdlHcPWDkqNFrfiyZ4guChN+b2Nk6FqU7o5fsZAIR7VAbgqNRF5XMo9Mhn/vhDCQRcnbXy7uq7JTrYUkqDbQoyYvT6b480GCY5gags1zp/xZfPDNZEe936o8i5IPTyiykRyNOXN/AH6kd3pR5e1xYgcvJ9KpSVPghcwFE7kJ4fOVMRhRG5ML+IyML+xD0jX43EMNoqRKZ/HS42kIMCInFbJEcxVde7DPNBZ7Y3GAqh7HO6qrE70Dn3ha6DID6zCoH2ArW39BxG4zempjn2VxYoMRGREyZszWQb++dwGoHmo5FHt6zvIrYBG0dA0H8ja9VkZkjFwtYTGHU1ooPzUfJK4O4VBayV8LqZibyZQR+GrmyQc0aagUY7J/fe4A2PJyI4DbkeZ7GX1ELj0ciDz4urQSzUc8l/T3aU3X+FuJItjgYtMLPmqcjA5uifDCtutE8Z9L2gSpanqUdvLSOozuxPho/KNl+2YlF7fXqPW3LnRf5mHD+NbOff306pvKlHJOb2Vmth+HBQ1XDzt/Cy5+sfwS3E0Vmh6UTq/NtkUXxwH10BDMF7FMVlQ4zdHQvyZ0=
|
||||||
- GH_REF=github.com/kubernetes/ingress-nginx
|
- secure: rKDoy9IYYYy0fYBs4+9mwuBVq/TcxfFwMfE0ywYWhUUdgzrUYSJAwpoe/96EQ4YmESUefwC2nDNq4G3XzJKYOWf83PaIveb9Z//zmMrCQXjDuDBDLpwV3sXSh7evXiVDohJz4ogBCeMRUCMKYsyKBM9yWfa/iu+yI92dbphpK9peOKW6yBc0uspJlln4swN3GS2WT9LVuPY2Azv9U2UqrXufOPDKG/qEb/Vrn4yZ2lR/50r2k45e9nSvDoByvr10V8ubM5Zc0iP0vBuAUVRdByv6N53Q4gaBGapY6SxhIjIPC/h0rNnuT9EXp7MWaPT5FmBxLt9wnyleT9QhZJnFyaBYqFgcz/DKifYQkryY4M5dLMo/Rt3yATyAy8Y0df1TOoV2dKdqwOOwQ8bXB1wDfyrGxmQj9HY4Ffnphx3wPE1a+Sjuh+S5Epm7XJbPx5pZJqNO2hd4sTbk0Xp3gpPbihny2r/jtNwHl0wpFCfOM68RNrsVRlIwG3UhzbZvblbQ/M/mmWCdgzINjt07I2SGCJxfKG0e98Q49SKUoDoOgQTTRDqTC9IgOEDxyfAkT0Vr6BtlP88Nsgnf6kmboyigBrRAiaDQGTxn3SP6LnQI3CeopaRDYvFZe/rTwPXE9XlKoTn9FTWnAqF3MuWaLslDcDKYEh7OaYJjF01piu6g4Nc=
|
||||||
- secure: LIS2XpZufWTcJ53jiRsSZy2Gi1EUJ1XmLg7z3f2ZHeMnyG2Jhk3GW4vod1FNru+PY4PWgddLdCdIl+jqOYXndFlbdAWF3/Oy5fEkYLXdYV7tdlHcPWDkqNFrfiyZ4guChN+b2Nk6FqU7o5fsZAIR7VAbgqNRF5XMo9Mhn/vhDCQRcnbXy7uq7JTrYUkqDbQoyYvT6b480GCY5gags1zp/xZfPDNZEe936o8i5IPTyiykRyNOXN/AH6kd3pR5e1xYgcvJ9KpSVPghcwFE7kJ4fOVMRhRG5ML+IyML+xD0jX43EMNoqRKZ/HS42kIMCInFbJEcxVde7DPNBZ7Y3GAqh7HO6qrE70Dn3ha6DID6zCoH2ArW39BxG4zempjn2VxYoMRGREyZszWQb++dwGoHmo5FHt6zvIrYBG0dA0H8ja9VkZkjFwtYTGHU1ooPzUfJK4O4VBayV8LqZibyZQR+GrmyQc0aagUY7J/fe4A2PJyI4DbkeZ7GX1ELj0ciDz4urQSzUc8l/T3aU3X+FuJItjgYtMLPmqcjA5uifDCtutE8Z9L2gSpanqUdvLSOozuxPho/KNl+2YlF7fXqPW3LnRf5mHD+NbOff306pvKlHJOb2Vmth+HBQ1XDzt/Cy5+sfwS3E0Vmh6UTq/NtkUXxwH10BDMF7FMVlQ4zdHQvyZ0=
|
- secure: qCCk7HIEnOph2q8mQ55MKS2MM0RSpCbwDZx7csF6NHRr5khVRyhg2r8jN0iUW+peoAChRYV91YOnl5v8K49O38IEQpzgADixiLu4VPFcYddwKrtTJF+AGvFGzBKtqDksRuUTqfJ+PdxGnO9iNkS0MFzF1ImSQGp1QfkegC8wSrZF8svAedjNOC9XV+FX0tTyj14eTSy3KUYafIyuhjG+nSjhlQxAI1Tq4EClcTZOzAIYNhkeZ4Gcu1nHPQMTQT5AQgRAhG8i7rNKfghqX8OccKNWUhvFB3eOFFf4dlb02IA2L/b8Fl4NnZpyAWcwF+CBZrzQoFARBE1xIvGfaNa9i6noyrpJ/g+0g7EyKgTsixaQInBmZ7ECVpQkSO+/3leWfwssZs7H4cqy2HeXH6dkE+JUeI0WDjYV7YwdVNoFm8wXszDu+MCQTGXJ4moO4F/jMvY4w+tNo8ISJiNZ/+uQaIlPaijCdwu9FPvAY59lJXORGVHd1Fq2pKkGkNjQVHtu9BH7ufO1fX5a6FtYbclMwm7w9BE5jnJNoP+y8Yq0bVwbGONSUFTyMWCbSCYDsyUPzmaZLkFpZPbnJua5y9c1x0/OYijNizBW0UVQDZauortsTPzwYlZ1J7TywVtpUEoI8CGuUb2QEWh+O/IwrogtiKvFtPrrYakIwV/lr7mO294=
|
||||||
- secure: rKDoy9IYYYy0fYBs4+9mwuBVq/TcxfFwMfE0ywYWhUUdgzrUYSJAwpoe/96EQ4YmESUefwC2nDNq4G3XzJKYOWf83PaIveb9Z//zmMrCQXjDuDBDLpwV3sXSh7evXiVDohJz4ogBCeMRUCMKYsyKBM9yWfa/iu+yI92dbphpK9peOKW6yBc0uspJlln4swN3GS2WT9LVuPY2Azv9U2UqrXufOPDKG/qEb/Vrn4yZ2lR/50r2k45e9nSvDoByvr10V8ubM5Zc0iP0vBuAUVRdByv6N53Q4gaBGapY6SxhIjIPC/h0rNnuT9EXp7MWaPT5FmBxLt9wnyleT9QhZJnFyaBYqFgcz/DKifYQkryY4M5dLMo/Rt3yATyAy8Y0df1TOoV2dKdqwOOwQ8bXB1wDfyrGxmQj9HY4Ffnphx3wPE1a+Sjuh+S5Epm7XJbPx5pZJqNO2hd4sTbk0Xp3gpPbihny2r/jtNwHl0wpFCfOM68RNrsVRlIwG3UhzbZvblbQ/M/mmWCdgzINjt07I2SGCJxfKG0e98Q49SKUoDoOgQTTRDqTC9IgOEDxyfAkT0Vr6BtlP88Nsgnf6kmboyigBrRAiaDQGTxn3SP6LnQI3CeopaRDYvFZe/rTwPXE9XlKoTn9FTWnAqF3MuWaLslDcDKYEh7OaYJjF01piu6g4Nc=
|
- secure: ZZlcwdr4X2ZeIuA4f5wiT04qNCpSiNQb9d3dITG7MdtxIpiC1mi9rUFAkMDDlNjKumHO82O/a/X4RYKjXny7eixeHl5lgQ++IV9APwvWfsCiREFhiQFspfL+j0d9sZ5I4pfyPC671984We1T4G+ltuMcN3nQdPm3mP4xPT3h0IBQ9iAHonKck0TdLieNZ47vPPB8C8oxbx5NpdW8aSfQJGo3bFGiXNxWWFZ4P7BsMBDrBZaXuh0rAml/0nCJBGohgSqC8h/UObBOHeehEWnF1zzfQPRezHwVkUaMf2+xQtLGhB5rPjFhBKX0C/JZeqDgHEQ0auC2bLbfG5QCYQauy7jCq5kc6XPT7xFxCUd/sS7Wu2gg6KcgFeTE+Rnn4KWFZx2jMP2EPQYP2+LrM/VbfY1HW4QkpIkPVSFBatciuePUnIkEX6+jVM+GEZOhOOEqZ89zwjsGpa2GkFAJrwX/dphXXtn6oS20mLbu1kqocWTbGUJl/fYztTxCdOt/NoH/hiQMxy+TOGFF3Dx85MJiMUOlgk/NbPqUwBn5RbuD71L69vFZZLpU09V4PuablWW8ACQxgp8BMeqLhaLRn/I3r0ntRc8AdQ1xubPlrVWO9DDbhGfj44YPNoLUAC/7QHkRyCbP98Yv2FTXrJFcx9isA2viFx2UxzTsvXcAKHbCSAw=
|
||||||
- secure: qCCk7HIEnOph2q8mQ55MKS2MM0RSpCbwDZx7csF6NHRr5khVRyhg2r8jN0iUW+peoAChRYV91YOnl5v8K49O38IEQpzgADixiLu4VPFcYddwKrtTJF+AGvFGzBKtqDksRuUTqfJ+PdxGnO9iNkS0MFzF1ImSQGp1QfkegC8wSrZF8svAedjNOC9XV+FX0tTyj14eTSy3KUYafIyuhjG+nSjhlQxAI1Tq4EClcTZOzAIYNhkeZ4Gcu1nHPQMTQT5AQgRAhG8i7rNKfghqX8OccKNWUhvFB3eOFFf4dlb02IA2L/b8Fl4NnZpyAWcwF+CBZrzQoFARBE1xIvGfaNa9i6noyrpJ/g+0g7EyKgTsixaQInBmZ7ECVpQkSO+/3leWfwssZs7H4cqy2HeXH6dkE+JUeI0WDjYV7YwdVNoFm8wXszDu+MCQTGXJ4moO4F/jMvY4w+tNo8ISJiNZ/+uQaIlPaijCdwu9FPvAY59lJXORGVHd1Fq2pKkGkNjQVHtu9BH7ufO1fX5a6FtYbclMwm7w9BE5jnJNoP+y8Yq0bVwbGONSUFTyMWCbSCYDsyUPzmaZLkFpZPbnJua5y9c1x0/OYijNizBW0UVQDZauortsTPzwYlZ1J7TywVtpUEoI8CGuUb2QEWh+O/IwrogtiKvFtPrrYakIwV/lr7mO294=
|
|
||||||
- secure: ZZlcwdr4X2ZeIuA4f5wiT04qNCpSiNQb9d3dITG7MdtxIpiC1mi9rUFAkMDDlNjKumHO82O/a/X4RYKjXny7eixeHl5lgQ++IV9APwvWfsCiREFhiQFspfL+j0d9sZ5I4pfyPC671984We1T4G+ltuMcN3nQdPm3mP4xPT3h0IBQ9iAHonKck0TdLieNZ47vPPB8C8oxbx5NpdW8aSfQJGo3bFGiXNxWWFZ4P7BsMBDrBZaXuh0rAml/0nCJBGohgSqC8h/UObBOHeehEWnF1zzfQPRezHwVkUaMf2+xQtLGhB5rPjFhBKX0C/JZeqDgHEQ0auC2bLbfG5QCYQauy7jCq5kc6XPT7xFxCUd/sS7Wu2gg6KcgFeTE+Rnn4KWFZx2jMP2EPQYP2+LrM/VbfY1HW4QkpIkPVSFBatciuePUnIkEX6+jVM+GEZOhOOEqZ89zwjsGpa2GkFAJrwX/dphXXtn6oS20mLbu1kqocWTbGUJl/fYztTxCdOt/NoH/hiQMxy+TOGFF3Dx85MJiMUOlgk/NbPqUwBn5RbuD71L69vFZZLpU09V4PuablWW8ACQxgp8BMeqLhaLRn/I3r0ntRc8AdQ1xubPlrVWO9DDbhGfj44YPNoLUAC/7QHkRyCbP98Yv2FTXrJFcx9isA2viFx2UxzTsvXcAKHbCSAw=
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- stage: Static Check
|
- stage: Static Check
|
||||||
script:
|
script:
|
||||||
- make static-check
|
- make static-check
|
||||||
- stage: Lua Unit Test
|
- stage: Lua Unit Test
|
||||||
script:
|
script:
|
||||||
- make lua-test
|
- make lua-test
|
||||||
- stage: Coverage
|
- stage: Coverage
|
||||||
script:
|
script:
|
||||||
- make cover
|
- make cover
|
||||||
- stage: e2e
|
- stage: e2e
|
||||||
if: (branch = master AND env(COMPONENT) != "docs") OR (type = pull_request AND commit_message !~ /(skip-e2e)/)
|
if: (branch = master AND env(COMPONENT) != "docs") OR (type = pull_request AND commit_message !~ /(skip-e2e)/)
|
||||||
before_script:
|
before_script:
|
||||||
- test/e2e/up.sh
|
- make e2e-test-image
|
||||||
script:
|
- test/e2e/up.sh
|
||||||
- make e2e-test
|
script:
|
||||||
# split builds to avoid job timeouts
|
- KUBECONFIG=$(cat /tmp/kubeconfig) make e2e-test
|
||||||
- stage: publish amd64
|
# split builds to avoid job timeouts
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
- stage: publish amd64
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
||||||
- .travis/publish.sh amd64
|
script:
|
||||||
- stage: publish arm
|
- .travis/publish.sh amd64
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
- stage: publish arm
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
||||||
- make register-qemu
|
script:
|
||||||
- .travis/publish.sh arm
|
- make register-qemu
|
||||||
- stage: publish arm64
|
- .travis/publish.sh arm
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
- stage: publish arm64
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
||||||
- make register-qemu
|
script:
|
||||||
- .travis/publish.sh arm64
|
- make register-qemu
|
||||||
- stage: publish ppc64le
|
- .travis/publish.sh arm64
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
- stage: publish ppc64le
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
||||||
- make register-qemu
|
script:
|
||||||
- .travis/publish.sh ppc64le
|
- make register-qemu
|
||||||
- stage: publish s390x
|
- .travis/publish.sh ppc64le
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
- stage: publish s390x
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "ingress-controller"
|
||||||
- make register-qemu
|
script:
|
||||||
- .travis/publish.sh s390x
|
- make register-qemu
|
||||||
- stage: Publish docs
|
- .travis/publish.sh s390x
|
||||||
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "docs"
|
- stage: Publish docs
|
||||||
script:
|
if: type = api AND branch = master AND repo = kubernetes/ingress-nginx AND env(COMPONENT) = "docs"
|
||||||
- .travis/publish-docs.sh
|
script:
|
||||||
|
- .travis/publish-docs.sh
|
||||||
|
|
41
Makefile
41
Makefile
|
@ -26,11 +26,9 @@ GOHOSTOS ?= $(shell go env GOHOSTOS)
|
||||||
# Allow limiting the scope of the e2e tests. By default run everything
|
# Allow limiting the scope of the e2e tests. By default run everything
|
||||||
FOCUS ?= .*
|
FOCUS ?= .*
|
||||||
# number of parallel test
|
# number of parallel test
|
||||||
E2E_NODES ?= 4
|
E2E_NODES ?= 8
|
||||||
# slow test only if takes > 40s
|
# slow test only if takes > 50s
|
||||||
SLOW_E2E_THRESHOLD ?= 40
|
SLOW_E2E_THRESHOLD ?= 50
|
||||||
|
|
||||||
NODE_IP ?= $(shell minikube ip)
|
|
||||||
|
|
||||||
ifeq ($(GOHOSTOS),darwin)
|
ifeq ($(GOHOSTOS),darwin)
|
||||||
SED_I=sed -i ''
|
SED_I=sed -i ''
|
||||||
|
@ -167,7 +165,6 @@ static-check:
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
@$(DEF_VARS) \
|
@$(DEF_VARS) \
|
||||||
NODE_IP=$(NODE_IP) \
|
|
||||||
DOCKER_OPTS="-i --net=host" \
|
DOCKER_OPTS="-i --net=host" \
|
||||||
build/go-in-docker.sh build/test.sh
|
build/go-in-docker.sh build/test.sh
|
||||||
|
|
||||||
|
@ -179,13 +176,31 @@ lua-test:
|
||||||
|
|
||||||
.PHONY: e2e-test
|
.PHONY: e2e-test
|
||||||
e2e-test:
|
e2e-test:
|
||||||
@$(DEF_VARS) \
|
echo "Granting permissions to ingress-nginx e2e service account..."
|
||||||
FOCUS=$(FOCUS) \
|
kubectl create serviceaccount ingress-nginx-e2e || true
|
||||||
E2E_NODES=$(E2E_NODES) \
|
kubectl create clusterrolebinding permissive-binding \
|
||||||
DOCKER_OPTS="-i --net=host" \
|
--clusterrole=cluster-admin \
|
||||||
NODE_IP=$(NODE_IP) \
|
--user=admin \
|
||||||
SLOW_E2E_THRESHOLD=$(SLOW_E2E_THRESHOLD) \
|
--user=kubelet \
|
||||||
build/go-in-docker.sh build/e2e-tests.sh
|
--serviceaccount=default:ingress-nginx-e2e || true
|
||||||
|
|
||||||
|
kubectl run --rm -i --tty \
|
||||||
|
--attach \
|
||||||
|
--restart=Never \
|
||||||
|
--generator=run-pod/v1 \
|
||||||
|
--env="E2E_NODES=$(E2E_NODES)" \
|
||||||
|
--env="FOCUS=$(FOCUS)" \
|
||||||
|
--env="SLOW_E2E_THRESHOLD=$(SLOW_E2E_THRESHOLD)" \
|
||||||
|
--overrides='{ "apiVersion": "v1", "spec":{"serviceAccountName": "ingress-nginx-e2e"}}' \
|
||||||
|
e2e --image=nginx-ingress-controller:e2e
|
||||||
|
|
||||||
|
.PHONY: e2e-test-image
|
||||||
|
e2e-test-image:
|
||||||
|
@$(DEF_VARS) \
|
||||||
|
DOCKER_OPTS="-i --net=host" \
|
||||||
|
build/go-in-docker.sh build/build-e2e.sh
|
||||||
|
|
||||||
|
make -C test/e2e-image
|
||||||
|
|
||||||
.PHONY: cover
|
.PHONY: cover
|
||||||
cover:
|
cover:
|
||||||
|
|
21
build/build-e2e.sh
Executable file
21
build/build-e2e.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2019 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
|
||||||
|
|
||||||
|
ginkgo build ./test/e2e
|
|
@ -1,69 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright 2018 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
|
|
||||||
|
|
||||||
declare -a mandatory
|
|
||||||
mandatory=(
|
|
||||||
NODE_IP
|
|
||||||
SLOW_E2E_THRESHOLD
|
|
||||||
PKG
|
|
||||||
FOCUS
|
|
||||||
E2E_NODES
|
|
||||||
)
|
|
||||||
|
|
||||||
missing=false
|
|
||||||
for var in ${mandatory[@]}; do
|
|
||||||
if [[ -z "${!var+x}" ]]; then
|
|
||||||
echo "Environment variable $var must be set"
|
|
||||||
missing=true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$missing" = true ];then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
|
||||||
|
|
||||||
ginkgo build ./test/e2e
|
|
||||||
|
|
||||||
echo "Running e2e test suite..."
|
|
||||||
ginkgo \
|
|
||||||
-randomizeSuites \
|
|
||||||
-randomizeAllSpecs \
|
|
||||||
-flakeAttempts=2 \
|
|
||||||
-focus=${FOCUS} \
|
|
||||||
-skip="\[Serial\]" \
|
|
||||||
-p \
|
|
||||||
-trace \
|
|
||||||
-nodes=${E2E_NODES} \
|
|
||||||
-slowSpecThreshold=${SLOW_E2E_THRESHOLD} \
|
|
||||||
test/e2e/e2e.test
|
|
||||||
|
|
||||||
echo "Running e2e test suite with tests that require serial execution..."
|
|
||||||
ginkgo \
|
|
||||||
-randomizeSuites \
|
|
||||||
-randomizeAllSpecs \
|
|
||||||
-flakeAttempts=2 \
|
|
||||||
-focus="\[Serial\]" \
|
|
||||||
-p \
|
|
||||||
-trace \
|
|
||||||
-nodes=1 \
|
|
||||||
-slowSpecThreshold=${SLOW_E2E_THRESHOLD} \
|
|
||||||
test/e2e/e2e.test
|
|
|
@ -50,18 +50,13 @@ tee .env << EOF
|
||||||
PKG=${PKG:-""}
|
PKG=${PKG:-""}
|
||||||
ARCH=${ARCH:-""}
|
ARCH=${ARCH:-""}
|
||||||
GIT_COMMIT=${GIT_COMMIT:-""}
|
GIT_COMMIT=${GIT_COMMIT:-""}
|
||||||
E2E_NODES=${E2E_NODES:-4}
|
|
||||||
FOCUS=${FOCUS:-.*}
|
|
||||||
TAG=${TAG:-"0.0"}
|
TAG=${TAG:-"0.0"}
|
||||||
HOME=${HOME:-/root}
|
HOME=${HOME:-/root}
|
||||||
KUBECONFIG=${HOME}/.kube/config
|
|
||||||
GOARCH=${GOARCH}
|
GOARCH=${GOARCH}
|
||||||
GOBUILD_FLAGS=${GOBUILD_FLAGS:-"-v"}
|
GOBUILD_FLAGS=${GOBUILD_FLAGS:-"-v"}
|
||||||
PWD=${PWD}
|
PWD=${PWD}
|
||||||
BUSTED_ARGS=${BUSTED_ARGS:-""}
|
BUSTED_ARGS=${BUSTED_ARGS:-""}
|
||||||
REPO_INFO=${REPO_INFO:-local}
|
REPO_INFO=${REPO_INFO:-local}
|
||||||
NODE_IP=${NODE_IP:-127.0.0.1}
|
|
||||||
SLOW_E2E_THRESHOLD=${SLOW_E2E_THRESHOLD:-40}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
MINIKUBE_PATH=${HOME}/.minikube
|
MINIKUBE_PATH=${HOME}/.minikube
|
||||||
|
|
3
test/e2e-image/.gitignore
vendored
Normal file
3
test/e2e-image/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
e2e.test
|
||||||
|
ginkgo
|
||||||
|
kubectl
|
17
test/e2e-image/Dockerfile
Normal file
17
test/e2e-image/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
FROM quay.io/kubernetes-ingress-controller/debian-base-amd64:0.1
|
||||||
|
|
||||||
|
RUN clean-install \
|
||||||
|
ca-certificates \
|
||||||
|
bash \
|
||||||
|
tzdata
|
||||||
|
|
||||||
|
COPY ginkgo /usr/local/bin/
|
||||||
|
COPY kubectl /usr/local/bin/
|
||||||
|
COPY e2e.sh /e2e.sh
|
||||||
|
|
||||||
|
COPY manifests /manifests
|
||||||
|
|
||||||
|
COPY wait-for-nginx.sh /
|
||||||
|
COPY e2e.test /
|
||||||
|
|
||||||
|
CMD [ "/e2e.sh" ]
|
23
test/e2e-image/Makefile
Normal file
23
test/e2e-image/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
IMAGE=nginx-ingress-controller:e2e
|
||||||
|
KUBE_VERSION ?= 1.13.3
|
||||||
|
|
||||||
|
.PHONY: all container getbins clean
|
||||||
|
|
||||||
|
all: container
|
||||||
|
|
||||||
|
container:
|
||||||
|
./kubectl > /dev/null 2>&1 || curl -Lo ./kubectl \
|
||||||
|
https://storage.googleapis.com/kubernetes-release/release/v$(KUBE_VERSION)/bin/linux/amd64/kubectl \
|
||||||
|
&& chmod +x ./kubectl
|
||||||
|
|
||||||
|
$(GOPATH)/bin/ginkgo > /dev/null 2>&1 || go get github.com/onsi/ginkgo/ginkgo
|
||||||
|
cp $(GOPATH)/bin/ginkgo .
|
||||||
|
|
||||||
|
cp ../e2e/e2e.test .
|
||||||
|
cp ../e2e/wait-for-nginx.sh .
|
||||||
|
|
||||||
|
docker build -t $(IMAGE) .
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf _cache e2e.test kubectl cluster ginkgo
|
||||||
|
docker rmi -f $(IMAGE) || true
|
61
test/e2e-image/e2e.sh
Executable file
61
test/e2e-image/e2e.sh
Executable file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2019 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
|
||||||
|
|
||||||
|
SLOW_E2E_THRESHOLD=${SLOW_E2E_THRESHOLD:-50}
|
||||||
|
FOCUS=${FOCUS:-.*}
|
||||||
|
E2E_NODES=${E2E_NODES:-5}
|
||||||
|
|
||||||
|
if [ ! -f ${HOME}/.kube/config ]; then
|
||||||
|
kubectl config set-cluster dev --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --embed-certs=true --server="https://kubernetes.default/"
|
||||||
|
kubectl config set-credentials user --token="$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
|
||||||
|
kubectl config set-context default --cluster=dev --user=user
|
||||||
|
kubectl config use-context default
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Granting permissions to ingress-nginx e2e service account..."
|
||||||
|
kubectl create serviceaccount ingress-nginx-e2e || true
|
||||||
|
kubectl create clusterrolebinding permissive-binding \
|
||||||
|
--clusterrole=cluster-admin \
|
||||||
|
--user=admin \
|
||||||
|
--user=kubelet \
|
||||||
|
--serviceaccount=default:ingress-nginx-e2e || true
|
||||||
|
|
||||||
|
kubectl apply -f manifests/rbac.yaml
|
||||||
|
|
||||||
|
ginkgo_args=(
|
||||||
|
"-randomizeSuites"
|
||||||
|
"-randomizeAllSpecs"
|
||||||
|
"-flakeAttempts=2"
|
||||||
|
"-p"
|
||||||
|
"-trace"
|
||||||
|
"--noColor=true"
|
||||||
|
"-slowSpecThreshold=${SLOW_E2E_THRESHOLD}"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Running e2e test suite..."
|
||||||
|
ginkgo "${ginkgo_args[@]}" \
|
||||||
|
-focus=${FOCUS} \
|
||||||
|
-skip="\[Serial\]" \
|
||||||
|
-nodes=${E2E_NODES} \
|
||||||
|
/e2e.test
|
||||||
|
|
||||||
|
echo "Running e2e test suite with tests that require serial execution..."
|
||||||
|
ginkgo "${ginkgo_args[@]}" \
|
||||||
|
-focus="\[Serial\]" \
|
||||||
|
-nodes=1 \
|
||||||
|
/e2e.test
|
|
@ -32,61 +32,6 @@ metadata:
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.io/name: ingress-nginx
|
app.kubernetes.io/name: ingress-nginx
|
||||||
app.kubernetes.io/part-of: ingress-nginx
|
app.kubernetes.io/part-of: ingress-nginx
|
||||||
---
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: nginx-ingress-clusterrole
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: ingress-nginx
|
|
||||||
app.kubernetes.io/part-of: ingress-nginx
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
- endpoints
|
|
||||||
- nodes
|
|
||||||
- pods
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- nodes
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- services
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- "extensions"
|
|
||||||
resources:
|
|
||||||
- ingresses
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- events
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- patch
|
|
||||||
- apiGroups:
|
|
||||||
- "extensions"
|
|
||||||
resources:
|
|
||||||
- ingresses/status
|
|
||||||
verbs:
|
|
||||||
- update
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
54
test/e2e-image/manifests/rbac.yaml
Normal file
54
test/e2e-image/manifests/rbac.yaml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: nginx-ingress-clusterrole
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: ingress-nginx
|
||||||
|
app.kubernetes.io/part-of: ingress-nginx
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- configmaps
|
||||||
|
- endpoints
|
||||||
|
- nodes
|
||||||
|
- pods
|
||||||
|
- secrets
|
||||||
|
verbs:
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- services
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- "extensions"
|
||||||
|
resources:
|
||||||
|
- ingresses
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- patch
|
||||||
|
- apiGroups:
|
||||||
|
- "extensions"
|
||||||
|
resources:
|
||||||
|
- ingresses/status
|
||||||
|
verbs:
|
||||||
|
- update
|
|
@ -3,16 +3,15 @@ kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: ingress-nginx
|
name: ingress-nginx
|
||||||
spec:
|
spec:
|
||||||
type: NodePort
|
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
- name: https
|
- name: https
|
||||||
port: 443
|
port: 443
|
||||||
targetPort: 443
|
targetPort: 443
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
selector:
|
selector:
|
||||||
app.kubernetes.io/name: ingress-nginx
|
app.kubernetes.io/name: ingress-nginx
|
||||||
app.kubernetes.io/part-of: ingress-nginx
|
app.kubernetes.io/part-of: ingress-nginx
|
44
test/e2e-image/wait-for-nginx.sh
Executable file
44
test/e2e-image/wait-for-nginx.sh
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/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 -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
export NAMESPACE=$1
|
||||||
|
|
||||||
|
echo "deploying NGINX Ingress controller in namespace $NAMESPACE"
|
||||||
|
|
||||||
|
function on_exit {
|
||||||
|
local error_code="$?"
|
||||||
|
|
||||||
|
test $error_code == 0 && return;
|
||||||
|
|
||||||
|
echo "Obtaining ingress controller pod logs..."
|
||||||
|
kubectl logs -l app.kubernetes.io/name=ingress-nginx -n $NAMESPACE
|
||||||
|
}
|
||||||
|
trap on_exit EXIT
|
||||||
|
|
||||||
|
kubectl apply --f $DIR/manifests/service.yaml
|
||||||
|
sed "s@\${NAMESPACE}@${NAMESPACE}@" $DIR/manifests/mandatory.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
||||||
|
cat $DIR/manifests/service.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
||||||
|
|
||||||
|
# wait for the deployment and fail if there is an error before starting the execution of any test
|
||||||
|
kubectl rollout status \
|
||||||
|
--request-timeout=3m \
|
||||||
|
--namespace $NAMESPACE \
|
||||||
|
deployment nginx-ingress-controller
|
|
@ -51,7 +51,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-hash": "sha1",
|
"nginx.ingress.kubernetes.io/session-cookie-hash": "sha1",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -131,7 +131,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
"nginx.ingress.kubernetes.io/session-cookie-name": "SERVERID",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -161,7 +161,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/something").
|
Get(f.GetURL(framework.HTTP)+"/something").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
f.EnsureIngress(&v1beta1.Ingress{
|
f.EnsureIngress(&v1beta1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: host,
|
Name: host,
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
Annotations: annotations,
|
Annotations: annotations,
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1beta1.IngressSpec{
|
||||||
|
@ -219,7 +219,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/something").
|
Get(f.GetURL(framework.HTTP)+"/something").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Path=/something;"))
|
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Path=/something;"))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/somewhereelese").
|
Get(f.GetURL(framework.HTTP)+"/somewhereelese").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-max-age": "259200",
|
"nginx.ingress.kubernetes.io/session-cookie-max-age": "259200",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -256,15 +256,19 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||||
local, _ := time.LoadLocation("GMT")
|
local, err := time.LoadLocation("GMT")
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(local).ShouldNot(BeNil())
|
||||||
|
|
||||||
duration, _ := time.ParseDuration("48h")
|
duration, _ := time.ParseDuration("48h")
|
||||||
expected := time.Now().In(local).Add(duration).Format("Mon, 02-Jan-06 15:04")
|
expected := time.Now().In(local).Add(duration).Format("Mon, 02-Jan-06 15:04")
|
||||||
|
|
||||||
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring(fmt.Sprintf("Expires=%s", expected)))
|
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring(fmt.Sprintf("Expires=%s", expected)))
|
||||||
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Max-Age=259200"))
|
Expect(resp.Header.Get("Set-Cookie")).Should(ContainSubstring("Max-Age=259200"))
|
||||||
})
|
})
|
||||||
|
@ -278,7 +282,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/session-cookie-path": "/foo/bar",
|
"nginx.ingress.kubernetes.io/session-cookie-path": "/foo/bar",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -288,7 +292,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -310,7 +314,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
"nginx.ingress.kubernetes.io/use-regex": "true",
|
"nginx.ingress.kubernetes.io/use-regex": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/foo/.*", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -320,7 +324,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -338,10 +342,10 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/affinity": "cookie",
|
"nginx.ingress.kubernetes.io/affinity": "cookie",
|
||||||
}
|
}
|
||||||
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing1 := framework.NewSingleIngress("ingress1", "/foo/bar", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing1)
|
f.EnsureIngress(ing1)
|
||||||
|
|
||||||
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
|
ing2 := framework.NewSingleIngress("ingress2", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
|
||||||
f.EnsureIngress(ing2)
|
f.EnsureIngress(ing2)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -351,7 +355,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo").
|
Get(f.GetURL(framework.HTTP)+"/foo").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -360,7 +364,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Affinity/Sticky Sessions",
|
||||||
Expect(resp.Header.Get("Set-Cookie")).Should(Equal(""))
|
Expect(resp.Header.Get("Set-Cookie")).Should(Equal(""))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -50,7 +50,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
|
||||||
Expect(body).Should(ContainSubstring(fmt.Sprintf("host=%v", host)))
|
Expect(body).Should(ContainSubstring(fmt.Sprintf("host=%v", host)))
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", "bar").
|
Set("Host", "bar").
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
|
||||||
"nginx.ingress.kubernetes.io/server-alias": "bar",
|
"nginx.ingress.kubernetes.io/server-alias": "bar",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -85,7 +85,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Alias", func() {
|
||||||
hosts := []string{"foo", "bar"}
|
hosts := []string{"foo", "bar"}
|
||||||
for _, host := range hosts {
|
for _, host := range hosts {
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Approot", func() {
|
||||||
"nginx.ingress.kubernetes.io/app-root": "/foo",
|
"nginx.ingress.kubernetes.io/app-root": "/foo",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Approot", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
|
|
@ -46,7 +46,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
It("should return status code 200 when no authentication is configured", func() {
|
It("should return status code 200 when no authentication is configured", func() {
|
||||||
host := "auth"
|
host := "auth"
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -82,7 +82,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
It("should return status code 401 when authentication is configured but Authorization header is not configured", func() {
|
It("should return status code 401 when authentication is configured but Authorization header is not configured", func() {
|
||||||
host := "auth"
|
host := "auth"
|
||||||
|
|
||||||
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
|
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
||||||
|
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -112,7 +112,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
It("should return status code 401 when authentication is configured and Authorization header is sent with invalid credentials", func() {
|
It("should return status code 401 when authentication is configured and Authorization header is sent with invalid credentials", func() {
|
||||||
host := "auth"
|
host := "auth"
|
||||||
|
|
||||||
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
|
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
||||||
|
@ -133,7 +133,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -142,7 +142,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
SetBasicAuth("user", "pass").
|
SetBasicAuth("user", "pass").
|
||||||
|
@ -156,7 +156,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
It("should return status code 200 when authentication is configured and Authorization header is sent", func() {
|
It("should return status code 200 when authentication is configured and Authorization header is sent", func() {
|
||||||
host := "auth"
|
host := "auth"
|
||||||
|
|
||||||
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.IngressController.Namespace))
|
s := f.EnsureSecret(buildSecret("foo", "bar", "test", f.Namespace))
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
"nginx.ingress.kubernetes.io/auth-type": "basic",
|
||||||
|
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -173,7 +173,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
SetBasicAuth("foo", "bar").
|
SetBasicAuth("foo", "bar").
|
||||||
|
@ -190,7 +190,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
&corev1.Secret{
|
&corev1.Secret{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
// invalid content
|
// invalid content
|
||||||
|
@ -206,7 +206,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
"nginx.ingress.kubernetes.io/auth-realm": "test auth",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -215,7 +215,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
SetBasicAuth("foo", "bar").
|
SetBasicAuth("foo", "bar").
|
||||||
|
@ -234,7 +234,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
proxy_set_header My-Custom-Header 42;`,
|
proxy_set_header My-Custom-Header 42;`,
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -251,7 +251,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
proxy_set_header My-Custom-Header 42;`,
|
proxy_set_header My-Custom-Header 42;`,
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -268,10 +268,10 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
|
|
||||||
var httpbinIP string
|
var httpbinIP string
|
||||||
|
|
||||||
err := framework.WaitForEndpoints(f.KubeClientSet, framework.DefaultTimeout, "httpbin", f.IngressController.Namespace, 1)
|
err := framework.WaitForEndpoints(f.KubeClientSet, framework.DefaultTimeout, "httpbin", f.Namespace, 1)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
e, err := f.KubeClientSet.CoreV1().Endpoints(f.IngressController.Namespace).Get("httpbin", metav1.GetOptions{})
|
e, err := f.KubeClientSet.CoreV1().Endpoints(f.Namespace).Get("httpbin", metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
httpbinIP = e.Subsets[0].Addresses[0].IP
|
httpbinIP = e.Subsets[0].Addresses[0].IP
|
||||||
|
@ -281,7 +281,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
|
"nginx.ingress.kubernetes.io/auth-signin": "http://$host/auth/start",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host, func(server string) bool {
|
f.WaitForNginxServer(host, func(server string) bool {
|
||||||
|
@ -291,7 +291,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
|
|
||||||
It("should return status code 200 when signed in", func() {
|
It("should return status code 200 when signed in", func() {
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
SetBasicAuth("user", "password").
|
SetBasicAuth("user", "password").
|
||||||
|
@ -305,7 +305,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Auth", func() {
|
||||||
|
|
||||||
It("should redirect to signin url when not signed in", func() {
|
It("should redirect to signin url when not signed in", func() {
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
RedirectPolicy(func(req gorequest.Request, via []gorequest.Request) error {
|
RedirectPolicy(func(req gorequest.Request, via []gorequest.Request) error {
|
||||||
|
|
|
@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
It("should set valid auth-tls-secret", func() {
|
It("should set valid auth-tls-secret", func() {
|
||||||
host := "authtls.foo.com"
|
host := "authtls.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
clientConfig, err := framework.CreateIngressMASecret(
|
clientConfig, err := framework.CreateIngressMASecret(
|
||||||
f.KubeClientSet,
|
f.KubeClientSet,
|
||||||
|
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
req := gorequest.New()
|
req := gorequest.New()
|
||||||
uri := "/"
|
uri := "/"
|
||||||
resp, _, errs := req.
|
resp, _, errs := req.
|
||||||
Get(f.IngressController.HTTPSURL+uri).
|
Get(f.GetURL(framework.HTTPS)+uri).
|
||||||
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -85,7 +85,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
// Send Request Passing the Client Certs
|
// Send Request Passing the Client Certs
|
||||||
resp, _, errs = req.
|
resp, _, errs = req.
|
||||||
Get(f.IngressController.HTTPSURL+uri).
|
Get(f.GetURL(framework.HTTPS)+uri).
|
||||||
TLSClientConfig(clientConfig).
|
TLSClientConfig(clientConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
It("should set valid auth-tls-secret, sslVerify to off, and sslVerifyDepth to 2", func() {
|
It("should set valid auth-tls-secret, sslVerify to off, and sslVerifyDepth to 2", func() {
|
||||||
host := "authtls.foo.com"
|
host := "authtls.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
_, err := framework.CreateIngressMASecret(
|
_, err := framework.CreateIngressMASecret(
|
||||||
f.KubeClientSet,
|
f.KubeClientSet,
|
||||||
|
@ -129,7 +129,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
req := gorequest.New()
|
req := gorequest.New()
|
||||||
uri := "/"
|
uri := "/"
|
||||||
resp, _, errs := req.
|
resp, _, errs := req.
|
||||||
Get(f.IngressController.HTTPSURL+uri).
|
Get(f.GetURL(framework.HTTPS)+uri).
|
||||||
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -139,7 +139,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
It("should set valid auth-tls-secret, pass certificate to upstream, and error page", func() {
|
It("should set valid auth-tls-secret, pass certificate to upstream, and error page", func() {
|
||||||
host := "authtls.foo.com"
|
host := "authtls.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
errorPath := "/error"
|
errorPath := "/error"
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/auth-tls-secret": nameSpace + "/" + host,
|
"nginx.ingress.kubernetes.io/auth-tls-secret": nameSpace + "/" + host,
|
||||||
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.IngressController.HTTPURL + errorPath,
|
"nginx.ingress.kubernetes.io/auth-tls-error-page": f.GetURL(framework.HTTP) + errorPath,
|
||||||
"nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream": "true",
|
"nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
|
|
||||||
sslVerify := "ssl_verify_client on;"
|
sslVerify := "ssl_verify_client on;"
|
||||||
sslVerifyDepth := "ssl_verify_depth 1;"
|
sslVerifyDepth := "ssl_verify_depth 1;"
|
||||||
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.IngressController.HTTPURL+errorPath)
|
sslErrorPage := fmt.Sprintf("error_page 495 496 = %s;", f.GetURL(framework.HTTP)+errorPath)
|
||||||
sslUpstreamClientCert := "proxy_set_header ssl-client-cert $ssl_client_escaped_cert;"
|
sslUpstreamClientCert := "proxy_set_header ssl-client-cert $ssl_client_escaped_cert;"
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -183,18 +183,18 @@ var _ = framework.IngressNginxDescribe("Annotations - AuthTLS", func() {
|
||||||
req := gorequest.New()
|
req := gorequest.New()
|
||||||
uri := "/"
|
uri := "/"
|
||||||
resp, _, errs := req.
|
resp, _, errs := req.
|
||||||
Get(f.IngressController.HTTPSURL+uri).
|
Get(f.GetURL(framework.HTTPS)+uri).
|
||||||
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
TLSClientConfig(&tls.Config{ServerName: host, InsecureSkipVerify: true}).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusFound))
|
Expect(resp.StatusCode).Should(Equal(http.StatusFound))
|
||||||
Expect(resp.Header.Get("Location")).Should(Equal(f.IngressController.HTTPURL + errorPath))
|
Expect(resp.Header.Get("Location")).Should(Equal(f.GetURL(framework.HTTP) + errorPath))
|
||||||
|
|
||||||
// Send Request Passing the Client Certs
|
// Send Request Passing the Client Certs
|
||||||
resp, _, errs = req.
|
resp, _, errs = req.
|
||||||
Get(f.IngressController.HTTPSURL+uri).
|
Get(f.GetURL(framework.HTTPS)+uri).
|
||||||
TLSClientConfig(clientConfig).
|
TLSClientConfig(clientConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
|
||||||
"nginx.ingress.kubernetes.io/backend-protocol": "HTTPS",
|
"nginx.ingress.kubernetes.io/backend-protocol": "HTTPS",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
|
||||||
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
|
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
|
||||||
"nginx.ingress.kubernetes.io/backend-protocol": "GRPCS",
|
"nginx.ingress.kubernetes.io/backend-protocol": "GRPCS",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Backendprotocol", func() {
|
||||||
"nginx.ingress.kubernetes.io/backend-protocol": "AJP",
|
"nginx.ingress.kubernetes.io/backend-protocol": "AJP",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -48,7 +48,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -63,14 +63,14 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
|
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -115,7 +115,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -130,7 +130,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
f.NewEchoDeploymentWithReplicas(0)
|
f.NewEchoDeploymentWithReplicas(0)
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -155,7 +155,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
f.NewDeployment("http-svc-canary", "gcr.io/kubernetes-e2e-test-images/echoserver:2.2", 8080, 0)
|
f.NewDeployment("http-svc-canary", "gcr.io/kubernetes-e2e-test-images/echoserver:2.2", 8080, 0)
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -169,7 +169,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -184,7 +184,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
By("routing requests destined for the mainline ingress to the maineline upstream")
|
By("routing requests destined for the mainline ingress to the maineline upstream")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -205,7 +205,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined for the canary ingress to the canary upstream")
|
By("routing requests destined for the canary ingress to the canary upstream")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -225,7 +225,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -243,7 +243,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
By("routing requests destined for the mainline ingress to the mainelin upstream")
|
By("routing requests destined for the mainline ingress to the mainelin upstream")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -256,7 +256,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined for the canary ingress to the canary upstream")
|
By("routing requests destined for the canary ingress to the canary upstream")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -270,7 +270,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -285,7 +285,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
}
|
}
|
||||||
|
|
||||||
modIng := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &modAnnotations)
|
modIng := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &modAnnotations)
|
||||||
|
|
||||||
f.EnsureIngress(modIng)
|
f.EnsureIngress(modIng)
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined fro the mainline ingress to the mainline upstream")
|
By("routing requests destined fro the mainline ingress to the mainline upstream")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -320,7 +320,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined for the canary ingress to the canary upstream")
|
By("routing requests destined for the canary ingress to the canary upstream")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -334,7 +334,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -349,7 +349,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader2",
|
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader2",
|
||||||
}
|
}
|
||||||
|
|
||||||
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
|
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
|
||||||
f.EnsureIngress(modCanaryIng)
|
f.EnsureIngress(modCanaryIng)
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
@ -368,7 +368,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined for the mainline ingress to the mainline upstream")
|
By("routing requests destined for the mainline ingress to the mainline upstream")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader2", "never").
|
Set("CanaryByHeader2", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -381,7 +381,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests destined for the canary ingress to the canary upstream")
|
By("routing requests destined for the canary ingress to the canary upstream")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader2", "always").
|
Set("CanaryByHeader2", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -397,7 +397,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -412,7 +412,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the canary upstream when header is set to 'always'")
|
By("routing requests to the canary upstream when header is set to 'always'")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -433,7 +433,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when header is set to 'never'")
|
By("routing requests to the mainline upstream when header is set to 'never'")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -446,7 +446,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when header is set to anything else")
|
By("routing requests to the mainline upstream when header is set to anything else")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "badheadervalue").
|
Set("CanaryByHeader", "badheadervalue").
|
||||||
End()
|
End()
|
||||||
|
@ -463,7 +463,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -479,7 +479,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the canary upstream when header is set to 'DoCanary'")
|
By("routing requests to the canary upstream when header is set to 'DoCanary'")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "DoCanary").
|
Set("CanaryByHeader", "DoCanary").
|
||||||
End()
|
End()
|
||||||
|
@ -500,7 +500,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when header is set to 'always'")
|
By("routing requests to the mainline upstream when header is set to 'always'")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "always").
|
Set("CanaryByHeader", "always").
|
||||||
End()
|
End()
|
||||||
|
@ -513,7 +513,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when header is set to 'never'")
|
By("routing requests to the mainline upstream when header is set to 'never'")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "never").
|
Set("CanaryByHeader", "never").
|
||||||
End()
|
End()
|
||||||
|
@ -526,7 +526,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when header is set to anything else")
|
By("routing requests to the mainline upstream when header is set to anything else")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "otherheadervalue").
|
Set("CanaryByHeader", "otherheadervalue").
|
||||||
End()
|
End()
|
||||||
|
@ -543,7 +543,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -560,7 +560,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
By("routing requests to the canary upstream when header value does not match and cookie is set to 'always'")
|
By("routing requests to the canary upstream when header value does not match and cookie is set to 'always'")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("CanaryByHeader", "otherheadervalue").
|
Set("CanaryByHeader", "otherheadervalue").
|
||||||
AddCookie(&http.Cookie{Name: "CanaryByCookie", Value: "always"}).
|
AddCookie(&http.Cookie{Name: "CanaryByCookie", Value: "always"}).
|
||||||
|
@ -585,7 +585,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -600,7 +600,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
By("routing requests to the canary upstream when cookie is set to 'always'")
|
By("routing requests to the canary upstream when cookie is set to 'always'")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "always"}).
|
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "always"}).
|
||||||
End()
|
End()
|
||||||
|
@ -620,7 +620,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when cookie is set to 'never'")
|
By("routing requests to the mainline upstream when cookie is set to 'never'")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "never"}).
|
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "never"}).
|
||||||
End()
|
End()
|
||||||
|
@ -633,7 +633,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("routing requests to the mainline upstream when cookie is set to anything else")
|
By("routing requests to the mainline upstream when cookie is set to anything else")
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "badcookievalue"}).
|
AddCookie(&http.Cookie{Name: "Canary-By-Cookie", Value: "badcookievalue"}).
|
||||||
End()
|
End()
|
||||||
|
@ -651,7 +651,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -666,7 +666,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
|
|
||||||
canaryIngName := fmt.Sprintf("%v-canary", host)
|
canaryIngName := fmt.Sprintf("%v-canary", host)
|
||||||
|
|
||||||
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary",
|
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary",
|
||||||
80, &canaryAnnotations)
|
80, &canaryAnnotations)
|
||||||
f.EnsureIngress(canaryIng)
|
f.EnsureIngress(canaryIng)
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
By("returning requests from the mainline only when weight is equal to 0")
|
By("returning requests from the mainline only when weight is equal to 0")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -691,14 +691,14 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
"nginx.ingress.kubernetes.io/canary-weight": "100",
|
"nginx.ingress.kubernetes.io/canary-weight": "100",
|
||||||
}
|
}
|
||||||
|
|
||||||
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
|
modCanaryIng := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &modCanaryAnnotations)
|
||||||
|
|
||||||
f.EnsureIngress(modCanaryIng)
|
f.EnsureIngress(modCanaryIng)
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -718,16 +718,16 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
|
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.IngressController.Namespace, "http-svc-canary", 80, &annotations)
|
ing := framework.NewSingleCatchAllIngress(canaryIngName, f.Namespace, "http-svc-canary", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
ing = framework.NewSingleCatchAllIngress(host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing = framework.NewSingleCatchAllIngress(host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer("_",
|
f.WaitForNginxServer("_",
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
upstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.IngressController.Namespace, "http-svc", "80")
|
upstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.Namespace, "http-svc", "80")
|
||||||
canaryUpstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.IngressController.Namespace, "http-svc-canary", "80")
|
canaryUpstreamName := fmt.Sprintf(`set $proxy_upstream_name "%s-%s-%s";`, f.Namespace, "http-svc-canary", "80")
|
||||||
return Expect(server).Should(ContainSubstring(`set $ingress_name "`+host+`";`)) &&
|
return Expect(server).Should(ContainSubstring(`set $ingress_name "`+host+`";`)) &&
|
||||||
Expect(server).ShouldNot(ContainSubstring(`set $proxy_upstream_name "upstream-default-backend";`)) &&
|
Expect(server).ShouldNot(ContainSubstring(`set $proxy_upstream_name "upstream-default-backend";`)) &&
|
||||||
Expect(server).ShouldNot(ContainSubstring(canaryUpstreamName)) &&
|
Expect(server).ShouldNot(ContainSubstring(canaryUpstreamName)) &&
|
||||||
|
@ -743,11 +743,11 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
|
||||||
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
|
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.IngressController.Namespace, "http-svc-canary", 80, &annotations)
|
ing := framework.NewSingleIngress(canaryIngName, "/", host, f.Namespace, "http-svc-canary", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
otherHost := "bar"
|
otherHost := "bar"
|
||||||
ing = framework.NewSingleIngress(otherHost, "/", otherHost, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing = framework.NewSingleIngress(otherHost, "/", otherHost, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1000",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1000",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1K",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1K",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1k",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1k",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1m",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1m",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -98,7 +98,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1M",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1M",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -113,7 +113,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Client-Body-Buffer-Size",
|
||||||
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1b",
|
"nginx.ingress.kubernetes.io/client-body-buffer-size": "1b",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Connection", func() {
|
||||||
"nginx.ingress.kubernetes.io/connection-proxy-header": "keep-alive",
|
"nginx.ingress.kubernetes.io/connection-proxy-header": "keep-alive",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -52,7 +52,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Connection", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/enable-cors": "true",
|
"nginx.ingress.kubernetes.io/enable-cors": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
|
|
||||||
uri := "/"
|
uri := "/"
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Options(f.IngressController.HTTPURL+uri).
|
Options(f.GetURL(framework.HTTP)+uri).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/cors-allow-methods": "POST, GET",
|
"nginx.ingress.kubernetes.io/cors-allow-methods": "POST, GET",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -102,7 +102,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/cors-max-age": "200",
|
"nginx.ingress.kubernetes.io/cors-max-age": "200",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/cors-allow-credentials": "false",
|
"nginx.ingress.kubernetes.io/cors-allow-credentials": "false",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -134,7 +134,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/cors-allow-origin": "https://origin.cors.com:8080",
|
"nginx.ingress.kubernetes.io/cors-allow-origin": "https://origin.cors.com:8080",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -150,7 +150,7 @@ var _ = framework.IngressNginxDescribe("Annotations - CORS", func() {
|
||||||
"nginx.ingress.kubernetes.io/cors-allow-headers": "DNT, User-Agent",
|
"nginx.ingress.kubernetes.io/cors-allow-headers": "DNT, User-Agent",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
|
||||||
"nginx.ingress.kubernetes.io/custom-http-errors": strings.Join(errorCodes, ","),
|
"nginx.ingress.kubernetes.io/custom-http-errors": strings.Join(errorCodes, ","),
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
var serverConfig string
|
var serverConfig string
|
||||||
|
@ -70,7 +70,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
|
||||||
}
|
}
|
||||||
|
|
||||||
By("updating configuration when only custom-http-error value changes")
|
By("updating configuration when only custom-http-error value changes")
|
||||||
err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||||
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "503"
|
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "503"
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom-http-errors", func(
|
||||||
|
|
||||||
By("ignoring duplicate values (503 in this case) per server")
|
By("ignoring duplicate values (503 in this case) per server")
|
||||||
annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "404, 503"
|
annotations["nginx.ingress.kubernetes.io/custom-http-errors"] = "404, 503"
|
||||||
ing = framework.NewSingleIngress(fmt.Sprintf("%s-else", host), "/else", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing = framework.NewSingleIngress(fmt.Sprintf("%s-else", host), "/else", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
f.WaitForNginxServer(host, func(sc string) bool {
|
f.WaitForNginxServer(host, func(sc string) bool {
|
||||||
serverConfig = sc
|
serverConfig = sc
|
||||||
|
|
|
@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
|
||||||
"nginx.ingress.kubernetes.io/default-backend": "http-svc",
|
"nginx.ingress.kubernetes.io/default-backend": "http-svc",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "invalid", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "invalid", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
|
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Annotations - custom default-backend", f
|
||||||
|
|
||||||
uri := "/alma/armud"
|
uri := "/alma/armud"
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+uri).
|
Get(f.GetURL(framework.HTTP)+uri).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Forcesslredirect", func()
|
||||||
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
|
"nginx.ingress.kubernetes.io/force-ssl-redirect": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Forcesslredirect", func()
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
|
|
@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
|
||||||
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
|
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
|
@ -59,7 +59,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
|
||||||
By("sending request to www.fromtowwwredirect.bar.com")
|
By("sending request to www.fromtowwwredirect.bar.com")
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(fmt.Sprintf("%s/%s", f.IngressController.HTTPURL, "foo")).
|
Get(fmt.Sprintf("%s/%s", f.GetURL(framework.HTTP), "foo")).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("Host", fmt.Sprintf("%s.%s", "www", host)).
|
Set("Host", fmt.Sprintf("%s.%s", "www", host)).
|
||||||
|
@ -78,7 +78,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
|
||||||
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
|
"nginx.ingress.kubernetes.io/from-to-www-redirect": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host, fmt.Sprintf("www.%v", host)}, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host, fmt.Sprintf("www.%v", host)}, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
|
@ -90,7 +90,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
|
||||||
f.WaitForNginxServer(fmt.Sprintf("www.%v", host),
|
f.WaitForNginxServer(fmt.Sprintf("www.%v", host),
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
return Expect(server).Should(ContainSubstring(`server_name www.fromtowwwredirect.bar.com;`)) &&
|
return Expect(server).Should(ContainSubstring(`server_name www.fromtowwwredirect.bar.com;`)) &&
|
||||||
Expect(server).Should(ContainSubstring(fmt.Sprintf("/etc/ingress-controller/ssl/%v-fromtowwwredirect.bar.com.pem", f.IngressController.Namespace))) &&
|
Expect(server).Should(ContainSubstring(fmt.Sprintf("/etc/ingress-controller/ssl/%v-fromtowwwredirect.bar.com.pem", f.Namespace))) &&
|
||||||
Expect(server).Should(ContainSubstring(`return 308 $scheme://fromtowwwredirect.bar.com$request_uri;`))
|
Expect(server).Should(ContainSubstring(`return 308 $scheme://fromtowwwredirect.bar.com$request_uri;`))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - from-to-www-redirect", fun
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
ServerName: h,
|
ServerName: h,
|
||||||
}).
|
}).
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("host", h).
|
Set("host", h).
|
||||||
|
|
|
@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - grpc", func() {
|
||||||
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
|
"nginx.ingress.kubernetes.io/backend-protocol": "GRPC",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "fortune-teller", 50051, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "fortune-teller", 50051, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - HTTP2 Push Preload", func(
|
||||||
"nginx.ingress.kubernetes.io/http2-push-preload": "true",
|
"nginx.ingress.kubernetes.io/http2-push-preload": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -67,7 +67,7 @@ var _ = framework.IngressNginxDescribe("Annotations - influxdb", func() {
|
||||||
// Do a request to the echo server ingress that sends metrics
|
// Do a request to the echo server ingress that sends metrics
|
||||||
// to the InfluxDB backend.
|
// to the InfluxDB backend.
|
||||||
res, _, errs := gorequest.New().
|
res, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func createInfluxDBService(f *framework.Framework) *corev1.Service {
|
||||||
service := &corev1.Service{
|
service := &corev1.Service{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "inflxudb-svc",
|
Name: "inflxudb-svc",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{
|
Spec: corev1.ServiceSpec{Ports: []corev1.ServicePort{
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ func createInfluxDBService(f *framework.Framework) *corev1.Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createInfluxDBIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
|
func createInfluxDBIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, service, port, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, service, port, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -133,7 +133,7 @@ func createInfluxDBIngress(f *framework.Framework, host, service string, port in
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractInfluxDBMeasurements(f *framework.Framework) (string, error) {
|
func extractInfluxDBMeasurements(f *framework.Framework) (string, error) {
|
||||||
l, err := f.KubeClientSet.CoreV1().Pods(f.IngressController.Namespace).List(metav1.ListOptions{
|
l, err := f.KubeClientSet.CoreV1().Pods(f.Namespace).List(metav1.ListOptions{
|
||||||
LabelSelector: "app=influxdb-svc",
|
LabelSelector: "app=influxdb-svc",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -37,7 +37,7 @@ var _ = framework.IngressNginxDescribe("Annotations - IPWhiteList", func() {
|
||||||
|
|
||||||
It("should set valid ip whitelist range", func() {
|
It("should set valid ip whitelist range", func() {
|
||||||
host := "ipwhitelist.foo.com"
|
host := "ipwhitelist.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/whitelist-source-range": "18.0.0.0/8, 56.0.0.0/8",
|
"nginx.ingress.kubernetes.io/whitelist-source-range": "18.0.0.0/8, 56.0.0.0/8",
|
||||||
|
|
|
@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Log", func() {
|
||||||
"nginx.ingress.kubernetes.io/enable-access-log": "false",
|
"nginx.ingress.kubernetes.io/enable-access-log": "false",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Log", func() {
|
||||||
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
|
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
|
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets": "41000_sqli, 42000_xss"})
|
"nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets": "41000_sqli, 42000_xss"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -70,7 +70,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
|
"nginx.ingress.kubernetes.io/lua-resty-waf": "active",
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf-score-threshold": "20"})
|
"nginx.ingress.kubernetes.io/lua-resty-waf-score-threshold": "20"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf-allow-unknown-content-types": "true",
|
"nginx.ingress.kubernetes.io/lua-resty-waf-allow-unknown-content-types": "true",
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf-process-multipart-body": "false",
|
"nginx.ingress.kubernetes.io/lua-resty-waf-process-multipart-body": "false",
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -119,7 +119,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
createIngress(f, host, "http-svc", 80, map[string]string{
|
createIngress(f, host, "http-svc", 80, map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
"nginx.ingress.kubernetes.io/lua-resty-waf": "active"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -148,7 +148,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
]=]`,
|
]=]`,
|
||||||
})
|
})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=my-message", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=my-message", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -157,7 +157,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
Expect(len(errs)).Should(Equal(0))
|
Expect(len(errs)).Should(Equal(0))
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||||
|
|
||||||
url = fmt.Sprintf("%s?msg=my-foo-message", f.IngressController.HTTPURL)
|
url = fmt.Sprintf("%s?msg=my-foo-message", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -172,7 +172,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
createIngress(f, host, "http-svc", 80, map[string]string{})
|
createIngress(f, host, "http-svc", 80, map[string]string{})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -185,7 +185,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "simulate"})
|
createIngress(f, host, "http-svc", 80, map[string]string{"nginx.ingress.kubernetes.io/lua-resty-waf": "simulate"})
|
||||||
|
|
||||||
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.IngressController.HTTPURL)
|
url := fmt.Sprintf("%s?msg=<A href=\"http://mysite.com/\">XSS</A>", f.GetURL(framework.HTTP))
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(url).
|
Get(url).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -203,7 +203,7 @@ var _ = framework.IngressNginxDescribe("Annotations - lua-resty-waf", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
func createIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
|
func createIngress(f *framework.Framework, host, service string, port int, annotations map[string]string) {
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, service, port, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, service, port, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -214,7 +214,7 @@ func createIngress(f *framework.Framework, host, service string, port int, annot
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
|
||||||
|
|
||||||
It("should enable modsecurity", func() {
|
It("should enable modsecurity", func() {
|
||||||
host := "modsecurity.foo.com"
|
host := "modsecurity.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
|
||||||
|
|
||||||
It("should enable modsecurity with transaction ID and OWASP rules", func() {
|
It("should enable modsecurity with transaction ID and OWASP rules", func() {
|
||||||
host := "modsecurity.foo.com"
|
host := "modsecurity.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
||||||
|
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
|
||||||
|
|
||||||
It("should disable modsecurity", func() {
|
It("should disable modsecurity", func() {
|
||||||
host := "modsecurity.foo.com"
|
host := "modsecurity.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/enable-modsecurity": "false",
|
"nginx.ingress.kubernetes.io/enable-modsecurity": "false",
|
||||||
|
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ModSecurityLocation", func
|
||||||
|
|
||||||
It("should enable modsecurity with snippet", func() {
|
It("should enable modsecurity with snippet", func() {
|
||||||
host := "modsecurity.foo.com"
|
host := "modsecurity.foo.com"
|
||||||
nameSpace := f.IngressController.Namespace
|
nameSpace := f.Namespace
|
||||||
|
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
"nginx.ingress.kubernetes.io/enable-modsecurity": "true",
|
||||||
|
|
|
@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -57,7 +57,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
"nginx.ingress.kubernetes.io/proxy-redirect-to": "goodbye.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -86,7 +86,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-body-size": "8m",
|
"nginx.ingress.kubernetes.io/proxy-body-size": "8m",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -100,7 +100,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-body-size": "15r",
|
"nginx.ingress.kubernetes.io/proxy-body-size": "15r",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -116,7 +116,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20",
|
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -134,7 +134,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20k",
|
"nginx.ingress.kubernetes.io/proxy-read-timeout": "20k",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
|
"nginx.ingress.kubernetes.io/proxy-buffer-size": "8k",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -168,7 +168,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-request-buffering": "off",
|
"nginx.ingress.kubernetes.io/proxy-request-buffering": "off",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -183,7 +183,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-next-upstream-tries": "5",
|
"nginx.ingress.kubernetes.io/proxy-next-upstream-tries": "5",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -199,7 +199,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Proxy", func() {
|
||||||
"nginx.ingress.kubernetes.io/proxy-cookie-path": "/one/ /",
|
"nginx.ingress.kubernetes.io/proxy-cookie-path": "/one/ /",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -52,7 +52,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
|
||||||
|
|
||||||
annotations := map[string]string{"nginx.ingress.kubernetes.io/permanent-redirect": redirectURL}
|
annotations := map[string]string{"nginx.ingress.kubernetes.io/permanent-redirect": redirectURL}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, redirectPath, host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -64,7 +64,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
|
||||||
By("sending request to redirected URL path")
|
By("sending request to redirected URL path")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+redirectPath).
|
Get(f.GetURL(framework.HTTP)+redirectPath).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
End()
|
End()
|
||||||
|
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
|
||||||
"nginx.ingress.kubernetes.io/permanent-redirect-code": strconv.Itoa(redirectCode),
|
"nginx.ingress.kubernetes.io/permanent-redirect-code": strconv.Itoa(redirectCode),
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, redirectPath, host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, redirectPath, host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -100,7 +100,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Redirect", func() {
|
||||||
By("sending request to redirected URL path")
|
By("sending request to redirected URL path")
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+redirectPath).
|
Get(f.GetURL(framework.HTTP)+redirectPath).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
|
"nginx.ingress.kubernetes.io/enable-rewrite-log": "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -56,7 +56,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/something").
|
Get(f.GetURL(framework.HTTP)+"/something").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
host := "rewrite.bar.com"
|
host := "rewrite.bar.com"
|
||||||
|
|
||||||
By("creating a regular ingress definition")
|
By("creating a regular ingress definition")
|
||||||
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
|
ing := framework.NewSingleIngress("kube-lego", "/.well-known/acme/challenge", host, f.Namespace, "http-svc", 80, &map[string]string{})
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -83,7 +83,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("making a request to the non-rewritten location")
|
By("making a request to the non-rewritten location")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
|
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/.well-known/acme/challenge", host)
|
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/.well-known/acme/challenge", host)
|
||||||
|
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
||||||
}
|
}
|
||||||
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
rewriteIng := framework.NewSingleIngress("rewrite-index", "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
|
|
||||||
f.EnsureIngress(rewriteIng)
|
f.EnsureIngress(rewriteIng)
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("making a second request to the non-rewritten location")
|
By("making a second request to the non-rewritten location")
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/.well-known/acme/challenge").
|
Get(f.GetURL(framework.HTTP)+"/.well-known/acme/challenge").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(len(errs)).Should(Equal(0))
|
Expect(len(errs)).Should(Equal(0))
|
||||||
|
@ -118,7 +118,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
host := "rewrite.bar.com"
|
host := "rewrite.bar.com"
|
||||||
|
|
||||||
By("creating a regular ingress definition")
|
By("creating a regular ingress definition")
|
||||||
ing := framework.NewSingleIngress("foo", "/foo", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
|
ing := framework.NewSingleIngress("foo", "/foo", host, f.Namespace, "http-svc", 80, &map[string]string{})
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -131,7 +131,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
"nginx.ingress.kubernetes.io/use-regex": "true",
|
"nginx.ingress.kubernetes.io/use-regex": "true",
|
||||||
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
||||||
}
|
}
|
||||||
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing = framework.NewSingleIngress("regex", "/foo.+", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -141,7 +141,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("ensuring '/foo' matches '~* ^/foo'")
|
By("ensuring '/foo' matches '~* ^/foo'")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo").
|
Get(f.GetURL(framework.HTTP)+"/foo").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/foo", host)
|
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/foo", host)
|
||||||
|
@ -151,7 +151,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("ensuring '/foo/bar' matches '~* ^/foo.+'")
|
By("ensuring '/foo/bar' matches '~* ^/foo.+'")
|
||||||
resp, body, errs = gorequest.New().
|
resp, body, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
expectBodyRequestURI = fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
|
expectBodyRequestURI = fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
|
||||||
|
@ -164,7 +164,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
host := "rewrite.bar.com"
|
host := "rewrite.bar.com"
|
||||||
|
|
||||||
By("creating a regular ingress definition")
|
By("creating a regular ingress definition")
|
||||||
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.IngressController.Namespace, "http-svc", 80, &map[string]string{})
|
ing := framework.NewSingleIngress("foo", "/foo/bar/bar", host, f.Namespace, "http-svc", 80, &map[string]string{})
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
By(`creating an ingress definition with the use-regex annotation`)
|
By(`creating an ingress definition with the use-regex annotation`)
|
||||||
|
@ -172,7 +172,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
"nginx.ingress.kubernetes.io/use-regex": "true",
|
"nginx.ingress.kubernetes.io/use-regex": "true",
|
||||||
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend",
|
||||||
}
|
}
|
||||||
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing = framework.NewSingleIngress("regex", "/foo/bar/[a-z]{3}", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -182,7 +182,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("check that '/foo/bar/bar' does not match the longest exact path")
|
By("check that '/foo/bar/bar' does not match the longest exact path")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
|
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend", host)
|
||||||
|
@ -199,7 +199,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
"nginx.ingress.kubernetes.io/use-regex": "true",
|
"nginx.ingress.kubernetes.io/use-regex": "true",
|
||||||
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend/$1",
|
"nginx.ingress.kubernetes.io/rewrite-target": "/new/backend/$1",
|
||||||
}
|
}
|
||||||
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress("regex", "/foo/bar/(.+)", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -209,7 +209,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Rewrite", func() {
|
||||||
|
|
||||||
By("check that '/foo/bar/bar' redirects to cusotm rewrite")
|
By("check that '/foo/bar/bar' redirects to cusotm rewrite")
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/foo/bar/bar").
|
Get(f.GetURL(framework.HTTP)+"/foo/bar/bar").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend/bar", host)
|
expectBodyRequestURI := fmt.Sprintf("request_uri=http://%v:8080/new/backend/bar", host)
|
||||||
|
|
|
@ -58,11 +58,11 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
|
||||||
annotationKey: "all",
|
annotationKey: "all",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &initAnnotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &initAnnotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
for key, result := range results {
|
for key, result := range results {
|
||||||
err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||||
ingress.ObjectMeta.Annotations[annotationKey] = annotations[key]
|
ingress.ObjectMeta.Annotations[annotationKey] = annotations[key]
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -74,7 +74,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SATISFY", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -42,7 +42,7 @@ var _ = framework.IngressNginxDescribe("Annotations - ServerSnippet", func() {
|
||||||
more_set_headers "Content-Type: $content_type";`,
|
more_set_headers "Content-Type: $content_type";`,
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Configurationsnippet", fun
|
||||||
more_set_headers "Request-Id: $req_id";`,
|
more_set_headers "Request-Id: $req_id";`,
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Annotations - SSL CIPHERS", func() {
|
||||||
"nginx.ingress.kubernetes.io/ssl-ciphers": "ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP",
|
"nginx.ingress.kubernetes.io/ssl-ciphers": "ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/something", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/something", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -33,7 +33,7 @@ import (
|
||||||
func startIngress(f *framework.Framework, annotations *map[string]string) map[string]bool {
|
func startIngress(f *framework.Framework, annotations *map[string]string) map[string]bool {
|
||||||
host := "upstream-hash-by.foo.com"
|
host := "upstream-hash-by.foo.com"
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -42,7 +42,7 @@ func startIngress(f *framework.Framework, annotations *map[string]string) map[st
|
||||||
|
|
||||||
err := wait.PollImmediate(framework.Poll, framework.DefaultTimeout, func() (bool, error) {
|
err := wait.PollImmediate(framework.Poll, framework.DefaultTimeout, func() (bool, error) {
|
||||||
resp, _, _ := gorequest.New().
|
resp, _, _ := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
if resp.StatusCode == http.StatusOK {
|
if resp.StatusCode == http.StatusOK {
|
||||||
|
@ -57,7 +57,7 @@ func startIngress(f *framework.Framework, annotations *map[string]string) map[st
|
||||||
|
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
_, body, errs := gorequest.New().
|
_, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Annotations - Upstreamvhost", func() {
|
||||||
"nginx.ingress.kubernetes.io/upstream-vhost": "upstreamvhost.bar.com",
|
"nginx.ingress.kubernetes.io/upstream-vhost": "upstreamvhost.bar.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
|
|
@ -40,7 +40,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
|
||||||
It("should list the backend servers", func() {
|
It("should list the backend servers", func() {
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||||
|
@ -60,7 +60,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
|
||||||
It("should get information for a specific backend server", func() {
|
It("should get information for a specific backend server", func() {
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||||
|
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Debug Tool", func() {
|
||||||
It("should produce valid JSON for /dbg general", func() {
|
It("should produce valid JSON for /dbg general", func() {
|
||||||
annotations := map[string]string{}
|
annotations := map[string]string{}
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
cmd := "/dbg general"
|
cmd := "/dbg general"
|
||||||
|
|
|
@ -37,12 +37,12 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
f.NewEchoDeploymentWithReplicas(1)
|
f.NewEchoDeploymentWithReplicas(1)
|
||||||
|
|
||||||
framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, fmt.Sprintf("--default-backend-service=%s/%s", f.IngressController.Namespace, "http-svc"))
|
args = append(args, fmt.Sprintf("--default-backend-service=%s/%s", f.Namespace, "http-svc"))
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("uses custom default backend", func() {
|
It("uses custom default backend", func() {
|
||||||
resp, _, errs := gorequest.New().Get(f.IngressController.HTTPURL).End()
|
resp, _, errs := gorequest.New().Get(f.GetURL(framework.HTTP)).End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||||
})
|
})
|
||||||
|
|
|
@ -76,9 +76,9 @@ var _ = framework.IngressNginxDescribe("Default backend", func() {
|
||||||
|
|
||||||
switch test.Scheme {
|
switch test.Scheme {
|
||||||
case framework.HTTP:
|
case framework.HTTP:
|
||||||
cm = request.CustomMethod(test.Method, f.IngressController.HTTPURL)
|
cm = request.CustomMethod(test.Method, f.GetURL(framework.HTTP))
|
||||||
case framework.HTTPS:
|
case framework.HTTPS:
|
||||||
cm = request.CustomMethod(test.Method, f.IngressController.HTTPSURL)
|
cm = request.CustomMethod(test.Method, f.GetURL(framework.HTTPS))
|
||||||
// the default backend uses a self generated certificate
|
// the default backend uses a self generated certificate
|
||||||
cm.Transport = &http.Transport{
|
cm.Transport = &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Default backend - SSL", func() {
|
||||||
It("should return a self generated SSL certificate", func() {
|
It("should return a self generated SSL certificate", func() {
|
||||||
By("checking SSL Certificate using the NGINX IP address")
|
By("checking SSL Certificate using the NGINX IP address")
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Post(f.IngressController.HTTPSURL).
|
Post(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(&tls.Config{
|
TLSClientConfig(&tls.Config{
|
||||||
// the default backend uses a self generated certificate
|
// the default backend uses a self generated certificate
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Default backend - SSL", func() {
|
||||||
|
|
||||||
By("checking SSL Certificate using the NGINX catch all server")
|
By("checking SSL Certificate using the NGINX catch all server")
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Post(f.IngressController.HTTPSURL).
|
Post(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(&tls.Config{
|
TLSClientConfig(&tls.Config{
|
||||||
// the default backend uses a self generated certificate
|
// the default backend uses a self generated certificate
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
|
|
|
@ -47,7 +47,7 @@ var _ = framework.IngressNginxDescribe("Default backend with hosts", func() {
|
||||||
ing := &extensions.Ingress{
|
ing := &extensions.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "default-backend-annotations",
|
Name: "default-backend-annotations",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
Annotations: annotations,
|
Annotations: annotations,
|
||||||
},
|
},
|
||||||
Spec: extensions.IngressSpec{
|
Spec: extensions.IngressSpec{
|
||||||
|
@ -71,7 +71,7 @@ var _ = framework.IngressNginxDescribe("Default backend with hosts", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", "foo.com").
|
Set("Host", "foo.com").
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -19,18 +19,15 @@ package e2e
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
|
||||||
"k8s.io/klog"
|
|
||||||
|
|
||||||
"k8s.io/ingress-nginx/test/e2e/framework"
|
"k8s.io/ingress-nginx/test/e2e/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
framework.RegisterParseFlags()
|
framework.RegisterParseFlags()
|
||||||
|
|
||||||
if "" == framework.TestContext.KubeConfig {
|
// if "" == framework.TestContext.KubeConfig {
|
||||||
klog.Fatalf("environment variable %v must be set", clientcmd.RecommendedConfigPathEnvVar)
|
// klog.Fatalf("environment variable %v must be set", clientcmd.RecommendedConfigPathEnvVar)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
func TestE2E(t *testing.T) {
|
func TestE2E(t *testing.T) {
|
||||||
RunE2ETests(t)
|
RunE2ETests(t)
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (f *Framework) NewDeployment(name, image string, port int32, replicas int32
|
||||||
deployment := &extensions.Deployment{
|
deployment := &extensions.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: NewInt32(replicas),
|
Replicas: NewInt32(replicas),
|
||||||
|
@ -115,7 +115,7 @@ func (f *Framework) NewDeployment(name, image string, port int32, replicas int32
|
||||||
service := &corev1.Service{
|
service := &corev1.Service{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: corev1.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
Ports: []corev1.ServicePort{
|
Ports: []corev1.ServicePort{
|
||||||
|
@ -135,6 +135,6 @@ func (f *Framework) NewDeployment(name, image string, port int32, replicas int32
|
||||||
s := f.EnsureService(service)
|
s := f.EnsureService(service)
|
||||||
Expect(s).NotTo(BeNil(), "expected a service but none returned")
|
Expect(s).NotTo(BeNil(), "expected a service but none returned")
|
||||||
|
|
||||||
err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.IngressController.Namespace, int(replicas))
|
err = WaitForEndpoints(f.KubeClientSet, DefaultTimeout, name, f.Namespace, int(replicas))
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for endpoints to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for endpoints to become ready")
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
|
|
||||||
// ExecIngressPod executes a command inside the first container in ingress controller running pod
|
// ExecIngressPod executes a command inside the first container in ingress controller running pod
|
||||||
func (f *Framework) ExecIngressPod(command string) (string, error) {
|
func (f *Framework) ExecIngressPod(command string) (string, error) {
|
||||||
pod, err := getIngressNGINXPod(f.IngressController.Namespace, f.KubeClientSet)
|
pod, err := getIngressNGINXPod(f.Namespace, f.KubeClientSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -65,13 +64,6 @@ type Framework struct {
|
||||||
// should abort, the AfterSuite hook should run all Cleanup actions.
|
// should abort, the AfterSuite hook should run all Cleanup actions.
|
||||||
cleanupHandle CleanupActionHandle
|
cleanupHandle CleanupActionHandle
|
||||||
|
|
||||||
IngressController *ingressController
|
|
||||||
}
|
|
||||||
|
|
||||||
type ingressController struct {
|
|
||||||
HTTPURL string
|
|
||||||
HTTPSURL string
|
|
||||||
|
|
||||||
Namespace string
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +85,11 @@ func (f *Framework) BeforeEach() {
|
||||||
f.cleanupHandle = AddCleanupAction(f.AfterEach)
|
f.cleanupHandle = AddCleanupAction(f.AfterEach)
|
||||||
|
|
||||||
By("Creating a kubernetes client")
|
By("Creating a kubernetes client")
|
||||||
kubeConfig, err := LoadConfig(TestContext.KubeConfig, TestContext.KubeContext)
|
kubeConfig, err := restclient.InClusterConfig()
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
f.KubeConfig = kubeConfig
|
f.KubeConfig = kubeConfig
|
||||||
|
@ -104,25 +100,17 @@ func (f *Framework) BeforeEach() {
|
||||||
ingressNamespace, err := CreateKubeNamespace(f.BaseName, f.KubeClientSet)
|
ingressNamespace, err := CreateKubeNamespace(f.BaseName, f.KubeClientSet)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
f.IngressController = &ingressController{
|
f.Namespace = ingressNamespace
|
||||||
Namespace: ingressNamespace,
|
|
||||||
}
|
|
||||||
|
|
||||||
By("Starting new ingress controller")
|
By("Starting new ingress controller")
|
||||||
err = f.NewIngressController(f.IngressController.Namespace)
|
err = f.NewIngressController(f.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
HTTPURL := f.GetNginxURL(HTTP)
|
|
||||||
f.IngressController.HTTPURL = HTTPURL
|
|
||||||
|
|
||||||
HTTPSURL := f.GetNginxURL(HTTPS)
|
|
||||||
f.IngressController.HTTPSURL = HTTPSURL
|
|
||||||
|
|
||||||
// we wait for any change in the informers and SSL certificate generation
|
// we wait for any change in the informers and SSL certificate generation
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
|
@ -132,7 +120,7 @@ func (f *Framework) AfterEach() {
|
||||||
RemoveCleanupAction(f.cleanupHandle)
|
RemoveCleanupAction(f.cleanupHandle)
|
||||||
|
|
||||||
By("Waiting for test namespace to no longer exist")
|
By("Waiting for test namespace to no longer exist")
|
||||||
err := DeleteKubeNamespace(f.KubeClientSet, f.IngressController.Namespace)
|
err := DeleteKubeNamespace(f.KubeClientSet, f.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
if CurrentGinkgoTestDescription().Failed {
|
if CurrentGinkgoTestDescription().Failed {
|
||||||
|
@ -148,52 +136,34 @@ func IngressNginxDescribe(text string, body func()) bool {
|
||||||
return Describe("[nginx-ingress] "+text, body)
|
return Describe("[nginx-ingress] "+text, body)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNginxIP returns the IP address of the minikube cluster
|
// GetNginxIP returns the number of TCP port where NGINX is running
|
||||||
// where the NGINX ingress controller is running
|
|
||||||
func (f *Framework) GetNginxIP() string {
|
func (f *Framework) GetNginxIP() string {
|
||||||
nodeIP := os.Getenv("NODE_IP")
|
|
||||||
Expect(nodeIP).NotTo(BeEmpty(), "env variable NODE_IP is empty")
|
|
||||||
return nodeIP
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetNginxPort returns the number of TCP port where NGINX is running
|
|
||||||
func (f *Framework) GetNginxPort(name string) (int, error) {
|
|
||||||
s, err := f.KubeClientSet.
|
s, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
Services(f.IngressController.Namespace).
|
Services(f.Namespace).
|
||||||
Get("ingress-nginx", metav1.GetOptions{})
|
Get("ingress-nginx", metav1.GetOptions{})
|
||||||
if err != nil {
|
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaning NGINX IP address")
|
||||||
return -1, err
|
return s.Spec.ClusterIP
|
||||||
}
|
|
||||||
|
|
||||||
for _, p := range s.Spec.Ports {
|
|
||||||
if p.NodePort != 0 && p.Name == name {
|
|
||||||
return int(p.NodePort), nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNginxURL returns the URL should be used to make a request to NGINX
|
// GetURL returns the URL should be used to make a request to NGINX
|
||||||
func (f *Framework) GetNginxURL(scheme RequestScheme) string {
|
func (f *Framework) GetURL(scheme RequestScheme) string {
|
||||||
ip := f.GetNginxIP()
|
ip := f.GetNginxIP()
|
||||||
port, err := f.GetNginxPort(fmt.Sprintf("%v", scheme))
|
return fmt.Sprintf("%v://%v", scheme, ip)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaning NGINX Port")
|
|
||||||
|
|
||||||
return fmt.Sprintf("%v://%v:%v", scheme, ip, port)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForNginxServer waits until the nginx configuration contains a particular server section
|
// WaitForNginxServer waits until the nginx configuration contains a particular server section
|
||||||
func (f *Framework) WaitForNginxServer(name string, matcher func(cfg string) bool) {
|
func (f *Framework) WaitForNginxServer(name string, matcher func(cfg string) bool) {
|
||||||
err := wait.Poll(Poll, time.Minute*5, f.matchNginxConditions(name, matcher))
|
err := wait.Poll(Poll, DefaultTimeout, f.matchNginxConditions(name, matcher))
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error waiting for nginx server condition/s")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error waiting for nginx server condition/s")
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitForNginxConfiguration waits until the nginx configuration contains a particular configuration
|
// WaitForNginxConfiguration waits until the nginx configuration contains a particular configuration
|
||||||
func (f *Framework) WaitForNginxConfiguration(matcher func(cfg string) bool) {
|
func (f *Framework) WaitForNginxConfiguration(matcher func(cfg string) bool) {
|
||||||
err := wait.Poll(Poll, time.Minute*5, f.matchNginxConditions("", matcher))
|
err := wait.Poll(Poll, DefaultTimeout, f.matchNginxConditions("", matcher))
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error waiting for nginx server condition/s")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error waiting for nginx server condition/s")
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
func nginxLogs(client kubernetes.Interface, namespace string) (string, error) {
|
func nginxLogs(client kubernetes.Interface, namespace string) (string, error) {
|
||||||
|
@ -211,14 +181,14 @@ func nginxLogs(client kubernetes.Interface, namespace string) (string, error) {
|
||||||
|
|
||||||
// NginxLogs returns the logs of the nginx ingress controller pod running
|
// NginxLogs returns the logs of the nginx ingress controller pod running
|
||||||
func (f *Framework) NginxLogs() (string, error) {
|
func (f *Framework) NginxLogs() (string, error) {
|
||||||
return nginxLogs(f.KubeClientSet, f.IngressController.Namespace)
|
return nginxLogs(f.KubeClientSet, f.Namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) bool) wait.ConditionFunc {
|
func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) bool) wait.ConditionFunc {
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
pod, err := getIngressNGINXPod(f.IngressController.Namespace, f.KubeClientSet)
|
pod, err := getIngressNGINXPod(f.Namespace, f.KubeClientSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmd string
|
var cmd string
|
||||||
|
@ -230,7 +200,7 @@ func (f *Framework) matchNginxConditions(name string, matcher func(cfg string) b
|
||||||
|
|
||||||
o, err := f.ExecCommand(pod, cmd)
|
o, err := f.ExecCommand(pod, cmd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var match bool
|
var match bool
|
||||||
|
@ -264,7 +234,7 @@ func (f *Framework) getNginxConfigMap() (*v1.ConfigMap, error) {
|
||||||
|
|
||||||
config, err := f.KubeClientSet.
|
config, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Get("nginx-configuration", metav1.GetOptions{})
|
Get("nginx-configuration", metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -298,7 +268,7 @@ func (f *Framework) SetNginxConfigMapData(cmData map[string]string) {
|
||||||
|
|
||||||
_, err = f.KubeClientSet.
|
_, err = f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Update(config)
|
Update(config)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
@ -318,14 +288,14 @@ func (f *Framework) UpdateNginxConfigMapData(key string, value string) {
|
||||||
// DeleteNGINXPod deletes the currently running pod. It waits for the replacement pod to be up.
|
// DeleteNGINXPod deletes the currently running pod. It waits for the replacement pod to be up.
|
||||||
// Grace period to wait for pod shutdown is in seconds.
|
// Grace period to wait for pod shutdown is in seconds.
|
||||||
func (f *Framework) DeleteNGINXPod(grace int64) {
|
func (f *Framework) DeleteNGINXPod(grace int64) {
|
||||||
ns := f.IngressController.Namespace
|
ns := f.Namespace
|
||||||
pod, err := getIngressNGINXPod(ns, f.KubeClientSet)
|
pod, err := getIngressNGINXPod(ns, f.KubeClientSet)
|
||||||
Expect(err).NotTo(HaveOccurred(), "expected ingress nginx pod to be running")
|
Expect(err).NotTo(HaveOccurred(), "expected ingress nginx pod to be running")
|
||||||
|
|
||||||
err = f.KubeClientSet.CoreV1().Pods(ns).Delete(pod.GetName(), metav1.NewDeleteOptions(grace))
|
err = f.KubeClientSet.CoreV1().Pods(ns).Delete(pod.GetName(), metav1.NewDeleteOptions(grace))
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error deleting ingress nginx pod")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error deleting ingress nginx pod")
|
||||||
|
|
||||||
err = wait.Poll(Poll, time.Minute*5, func() (bool, error) {
|
err = wait.Poll(Poll, DefaultTimeout, func() (bool, error) {
|
||||||
pod, err := getIngressNGINXPod(ns, f.KubeClientSet)
|
pod, err := getIngressNGINXPod(ns, f.KubeClientSet)
|
||||||
if err != nil || pod == nil {
|
if err != nil || pod == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32
|
||||||
deployment := &extensions.Deployment{
|
deployment := &extensions.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "fortune-teller",
|
Name: "fortune-teller",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: NewInt32(replicas),
|
Replicas: NewInt32(replicas),
|
||||||
|
@ -77,7 +77,7 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(d).NotTo(BeNil(), "expected a fortune-teller deployment")
|
Expect(d).NotTo(BeNil(), "expected a fortune-teller deployment")
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, int(replicas), f.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for to become ready")
|
||||||
|
@ -85,7 +85,7 @@ func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32
|
||||||
service := &corev1.Service{
|
service := &corev1.Service{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "fortune-teller",
|
Name: "fortune-teller",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: corev1.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
Ports: []corev1.ServicePort{
|
Ports: []corev1.ServicePort{
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (f *Framework) NewInfluxDBDeployment() {
|
||||||
configuration := &corev1.ConfigMap{
|
configuration := &corev1.ConfigMap{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "influxdb-config",
|
Name: "influxdb-config",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Data: map[string]string{
|
Data: map[string]string{
|
||||||
"influxd.conf": influxConfig,
|
"influxd.conf": influxConfig,
|
||||||
|
@ -76,7 +76,7 @@ func (f *Framework) NewInfluxDBDeployment() {
|
||||||
deployment := &extensions.Deployment{
|
deployment := &extensions.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "influxdb-svc",
|
Name: "influxdb-svc",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Spec: extensions.DeploymentSpec{
|
Spec: extensions.DeploymentSpec{
|
||||||
Replicas: NewInt32(1),
|
Replicas: NewInt32(1),
|
||||||
|
@ -140,7 +140,7 @@ func (f *Framework) NewInfluxDBDeployment() {
|
||||||
|
|
||||||
Expect(d).NotTo(BeNil(), "unexpected error creating deployement for influxdb")
|
Expect(d).NotTo(BeNil(), "unexpected error creating deployement for influxdb")
|
||||||
|
|
||||||
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.IngressController.Namespace, metav1.ListOptions{
|
err = WaitForPodsReady(f.KubeClientSet, DefaultTimeout, 1, f.Namespace, metav1.ListOptions{
|
||||||
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
LabelSelector: fields.SelectorFromSet(fields.Set(d.Spec.Template.ObjectMeta.Labels)).String(),
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred(), "failed to wait for influxdb to become ready")
|
Expect(err).NotTo(HaveOccurred(), "failed to wait for influxdb to become ready")
|
||||||
|
|
|
@ -124,7 +124,7 @@ func WaitForPodsReady(kubeClientSet kubernetes.Interface, timeout time.Duration,
|
||||||
return wait.Poll(2*time.Second, timeout, func() (bool, error) {
|
return wait.Poll(2*time.Second, timeout, func() (bool, error) {
|
||||||
pl, err := kubeClientSet.CoreV1().Pods(namespace).List(opts)
|
pl, err := kubeClientSet.CoreV1().Pods(namespace).List(opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := 0
|
r := 0
|
||||||
|
@ -150,11 +150,11 @@ func WaitForEndpoints(kubeClientSet kubernetes.Interface, timeout time.Duration,
|
||||||
return wait.Poll(2*time.Second, timeout, func() (bool, error) {
|
return wait.Poll(2*time.Second, timeout, func() (bool, error) {
|
||||||
endpoint, err := kubeClientSet.CoreV1().Endpoints(ns).Get(name, metav1.GetOptions{})
|
endpoint, err := kubeClientSet.CoreV1().Endpoints(ns).Get(name, metav1.GetOptions{})
|
||||||
if k8sErrors.IsNotFound(err) {
|
if k8sErrors.IsNotFound(err) {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
if len(endpoint.Subsets) == 0 || len(endpoint.Subsets[0].Addresses) == 0 {
|
if len(endpoint.Subsets) == 0 || len(endpoint.Subsets[0].Addresses) == 0 {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := 0
|
r := 0
|
||||||
|
@ -191,7 +191,7 @@ func getIngressNGINXPod(ns string, kubeClientSet kubernetes.Interface) (*core.Po
|
||||||
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
LabelSelector: "app.kubernetes.io/name=ingress-nginx",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(l.Items) == 0 {
|
if len(l.Items) == 0 {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import (
|
||||||
|
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
|
@ -338,19 +338,24 @@ func tlsConfig(serverName string, pemCA []byte) (*tls.Config, error) {
|
||||||
// given URL using the given TLS configuration and returns whether the TLS
|
// given URL using the given TLS configuration and returns whether the TLS
|
||||||
// handshake completed successfully.
|
// handshake completed successfully.
|
||||||
func matchTLSServerName(url string, tlsConfig *tls.Config) wait.ConditionFunc {
|
func matchTLSServerName(url string, tlsConfig *tls.Config) wait.ConditionFunc {
|
||||||
return func() (ready bool, err error) {
|
return func() (bool, error) {
|
||||||
u, err := net_url.Parse(url)
|
u, err := net_url.Parse(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := tls.Dial("tcp", u.Host, tlsConfig)
|
port := u.Port()
|
||||||
|
if port == "" {
|
||||||
|
port = "443"
|
||||||
|
}
|
||||||
|
|
||||||
|
conn, err := tls.Dial("tcp", fmt.Sprintf("%v:%v", u.Host, port), tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Logf("Unexpected TLS error: %v", err)
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
||||||
ready = true
|
return true, nil
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,17 +18,14 @@ package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/config"
|
"github.com/onsi/ginkgo/config"
|
||||||
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestContextType describes the client context to use in communications with the Kubernetes API.
|
// TestContextType describes the client context to use in communications with the Kubernetes API.
|
||||||
type TestContextType struct {
|
type TestContextType struct {
|
||||||
KubeHost string
|
KubeHost string
|
||||||
KubeConfig string
|
//KubeConfig string
|
||||||
KubeContext string
|
KubeContext string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +48,7 @@ func RegisterCommonFlags() {
|
||||||
config.DefaultReporterConfig.SlowSpecThreshold = 20
|
config.DefaultReporterConfig.SlowSpecThreshold = 20
|
||||||
|
|
||||||
flag.StringVar(&TestContext.KubeHost, "kubernetes-host", "http://127.0.0.1:8080", "The kubernetes host, or apiserver, to connect to")
|
flag.StringVar(&TestContext.KubeHost, "kubernetes-host", "http://127.0.0.1:8080", "The kubernetes host, or apiserver, to connect to")
|
||||||
flag.StringVar(&TestContext.KubeConfig, "kubernetes-config", os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to config containing embedded authinfo for kubernetes. Default value is from environment variable "+clientcmd.RecommendedConfigPathEnvVar)
|
//flag.StringVar(&TestContext.KubeConfig, "kubernetes-config", os.Getenv(clientcmd.RecommendedConfigPathEnvVar), "Path to config containing embedded authinfo for kubernetes. Default value is from environment variable "+clientcmd.RecommendedConfigPathEnvVar)
|
||||||
flag.StringVar(&TestContext.KubeContext, "kubernetes-context", "", "config context to use for kubernetes. If unset, will use value from 'current-context'")
|
flag.StringVar(&TestContext.KubeContext, "kubernetes-context", "", "config context to use for kubernetes. If unset, will use value from 'current-context'")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,12 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/rest"
|
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
"k8s.io/client-go/tools/clientcmd/api"
|
"k8s.io/client-go/tools/clientcmd/api"
|
||||||
"k8s.io/ingress-nginx/internal/file"
|
"k8s.io/ingress-nginx/internal/file"
|
||||||
|
@ -37,10 +36,10 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Poll how often to poll for conditions
|
// Poll how often to poll for conditions
|
||||||
Poll = 2 * time.Second
|
Poll = 3 * time.Second
|
||||||
|
|
||||||
// DefaultTimeout time to wait for operations to complete
|
// DefaultTimeout time to wait for operations to complete
|
||||||
DefaultTimeout = 5 * time.Minute
|
DefaultTimeout = 3 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
func nowStamp() string {
|
func nowStamp() string {
|
||||||
|
@ -87,15 +86,6 @@ func RestclientConfig(config, context string) (*api.Config, error) {
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadConfig deserializes the contents of a kubeconfig file into a REST configuration.
|
|
||||||
func LoadConfig(config, context string) (*rest.Config, error) {
|
|
||||||
c, err := RestclientConfig(config, context)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return clientcmd.NewDefaultClientConfig(*c, &clientcmd.ConfigOverrides{}).ClientConfig()
|
|
||||||
}
|
|
||||||
|
|
||||||
// RunID unique identifier of the e2e run
|
// RunID unique identifier of the e2e run
|
||||||
var RunID = uuid.NewUUID()
|
var RunID = uuid.NewUUID()
|
||||||
|
|
||||||
|
@ -109,8 +99,9 @@ func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error
|
||||||
}
|
}
|
||||||
// Be robust about making the namespace creation call.
|
// Be robust about making the namespace creation call.
|
||||||
var got *v1.Namespace
|
var got *v1.Namespace
|
||||||
err := wait.PollImmediate(Poll, DefaultTimeout, func() (bool, error) {
|
var err error
|
||||||
var err error
|
|
||||||
|
err = wait.PollImmediate(Poll, DefaultTimeout, func() (bool, error) {
|
||||||
got, err = c.CoreV1().Namespaces().Create(ns)
|
got, err = c.CoreV1().Namespaces().Create(ns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Logf("Unexpected error while creating namespace: %v", err)
|
Logf("Unexpected error while creating namespace: %v", err)
|
||||||
|
@ -200,7 +191,7 @@ func secretInNamespace(c kubernetes.Interface, namespace, name string) wait.Cond
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
s, err := c.CoreV1().Secrets(namespace).Get(name, metav1.GetOptions{})
|
s, err := c.CoreV1().Secrets(namespace).Get(name, metav1.GetOptions{})
|
||||||
if apierrors.IsNotFound(err) {
|
if apierrors.IsNotFound(err) {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
@ -268,7 +259,7 @@ func ingressInNamespace(c kubernetes.Interface, namespace, name string) wait.Con
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
ing, err := c.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{})
|
ing, err := c.ExtensionsV1beta1().Ingresses(namespace).Get(name, metav1.GetOptions{})
|
||||||
if apierrors.IsNotFound(err) {
|
if apierrors.IsNotFound(err) {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
@ -285,7 +276,7 @@ func podRunning(c kubernetes.Interface, podName, namespace string) wait.Conditio
|
||||||
return func() (bool, error) {
|
return func() (bool, error) {
|
||||||
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
switch pod.Status.Phase {
|
switch pod.Status.Phase {
|
||||||
case v1.PodRunning:
|
case v1.PodRunning:
|
||||||
|
|
|
@ -38,7 +38,7 @@ var _ = framework.IngressNginxDescribe("Graceful Shutdown - Slow Requests", func
|
||||||
It("should let slow requests finish before shutting down", func() {
|
It("should let slow requests finish before shutting down", func() {
|
||||||
host := "graceful-shutdown"
|
host := "graceful-shutdown"
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "slowecho", 8080, nil))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "slowecho", 8080, nil))
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(conf string) bool {
|
func(conf string) bool {
|
||||||
return strings.Contains(conf, "worker_shutdown_timeout")
|
return strings.Contains(conf, "worker_shutdown_timeout")
|
||||||
|
@ -49,7 +49,7 @@ var _ = framework.IngressNginxDescribe("Graceful Shutdown - Slow Requests", func
|
||||||
defer func() { done <- true }()
|
defer func() { done <- true }()
|
||||||
defer GinkgoRecover()
|
defer GinkgoRecover()
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL+"/sleep/30").
|
Get(f.GetURL(framework.HTTP)+"/sleep/30").
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
|
|
@ -43,7 +43,7 @@ var _ = framework.IngressNginxDescribe("Load Balance - Round Robin", func() {
|
||||||
It("should evenly distribute requests with round-robin (default algorithm)", func() {
|
It("should evenly distribute requests with round-robin (default algorithm)", func() {
|
||||||
host := "load-balance.com"
|
host := "load-balance.com"
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
return strings.Contains(server, "server_name load-balance.com")
|
return strings.Contains(server, "server_name load-balance.com")
|
||||||
|
@ -54,7 +54,7 @@ var _ = framework.IngressNginxDescribe("Load Balance - Round Robin", func() {
|
||||||
|
|
||||||
for i := 0; i < 600; i++ {
|
for i := 0; i < 600; i++ {
|
||||||
_, body, errs := gorequest.New().
|
_, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
|
|
@ -36,13 +36,13 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
host := "foo.com"
|
host := "foo.com"
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
err := framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, "--enable-dynamic-certificates")
|
args = append(args, "--enable-dynamic-certificates")
|
||||||
args = append(args, "--enable-ssl-chain-completion=false")
|
args = append(args, "--enable-ssl-chain-completion=false")
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -59,7 +59,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
It("picks up the certificate when we add TLS spec to existing ingress", func() {
|
It("picks up the certificate when we add TLS spec to existing ingress", func() {
|
||||||
ensureIngress(f, host, "http-svc")
|
ensureIngress(f, host, "http-svc")
|
||||||
|
|
||||||
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
ing.Spec.TLS = []extensions.IngressTLS{
|
ing.Spec.TLS = []extensions.IngressTLS{
|
||||||
{
|
{
|
||||||
|
@ -72,20 +72,20 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
ing.Namespace)
|
ing.Namespace)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Update(ing)
|
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, host)
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, host)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("picks up the previously missing secret for a given ingress without reloading", func() {
|
It("picks up the previously missing secret for a given ingress without reloading", func() {
|
||||||
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.IngressController.HTTPSURL), host, "ingress.local")
|
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, "ingress.local")
|
||||||
|
|
||||||
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
|
@ -105,7 +105,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
By("serving the configured certificate on HTTPS endpoint")
|
By("serving the configured certificate on HTTPS endpoint")
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, host)
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, host)
|
||||||
|
|
||||||
log, err := f.NginxLogs()
|
log, err := f.NginxLogs()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -120,11 +120,11 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
|
|
||||||
Context("given an ingress with TLS correctly configured", func() {
|
Context("given an ingress with TLS correctly configured", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
|
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, "ingress.local")
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, "ingress.local")
|
||||||
|
|
||||||
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
|
@ -145,14 +145,14 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
By("serving the configured certificate on HTTPS endpoint")
|
By("serving the configured certificate on HTTPS endpoint")
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, host)
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, host)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("picks up the updated certificate without reloading", func() {
|
It("picks up the updated certificate without reloading", func() {
|
||||||
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.IngressController.HTTPSURL), host, host)
|
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host)
|
||||||
|
|
||||||
_, err = framework.CreateIngressTLSSecret(f.KubeClientSet,
|
_, err = framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
|
@ -173,7 +173,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
By("serving the configured certificate on HTTPS endpoint")
|
By("serving the configured certificate on HTTPS endpoint")
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, host)
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, host)
|
||||||
|
|
||||||
log, err := f.NginxLogs()
|
log, err := f.NginxLogs()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -187,9 +187,9 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("falls back to using default certificate when secret gets deleted without reloading", func() {
|
It("falls back to using default certificate when secret gets deleted without reloading", func() {
|
||||||
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
|
|
||||||
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.IngressController.HTTPSURL), host, host)
|
ensureHTTPSRequest(fmt.Sprintf("%s?id=dummy_log_splitter_foo_bar", f.GetURL(framework.HTTPS)), host, host)
|
||||||
|
|
||||||
f.KubeClientSet.CoreV1().Secrets(ing.Namespace).Delete(ing.Spec.TLS[0].SecretName, nil)
|
f.KubeClientSet.CoreV1().Secrets(ing.Namespace).Delete(ing.Spec.TLS[0].SecretName, nil)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -207,7 +207,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
By("serving the default certificate on HTTPS endpoint")
|
By("serving the default certificate on HTTPS endpoint")
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, host, "ingress.local")
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), host, "ingress.local")
|
||||||
|
|
||||||
log, err := f.NginxLogs()
|
log, err := f.NginxLogs()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -222,22 +222,22 @@ var _ = framework.IngressNginxDescribe("Dynamic Certificate", func() {
|
||||||
|
|
||||||
It("picks up a non-certificate only change", func() {
|
It("picks up a non-certificate only change", func() {
|
||||||
newHost := "foo2.com"
|
newHost := "foo2.com"
|
||||||
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
ing.Spec.Rules[0].Host = newHost
|
ing.Spec.Rules[0].Host = newHost
|
||||||
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Update(ing)
|
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
By("serving the configured certificate on HTTPS endpoint")
|
By("serving the configured certificate on HTTPS endpoint")
|
||||||
ensureHTTPSRequest(f.IngressController.HTTPSURL, newHost, "ingress.local")
|
ensureHTTPSRequest(f.GetURL(framework.HTTPS), newHost, "ingress.local")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("removes HTTPS configuration when we delete TLS spec", func() {
|
It("removes HTTPS configuration when we delete TLS spec", func() {
|
||||||
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
ing.Spec.TLS = []extensions.IngressTLS{}
|
ing.Spec.TLS = []extensions.IngressTLS{}
|
||||||
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Update(ing)
|
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ing)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
replicas := 2
|
replicas := 2
|
||||||
err := framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "http-svc", replicas, nil)
|
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "http-svc", replicas, nil)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
replicas := 2
|
replicas := 2
|
||||||
err := framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "http-svc", replicas, nil)
|
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "http-svc", replicas, nil)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync * 2)
|
time.Sleep(waitForLuaSync * 2)
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
})
|
})
|
||||||
Expect(nginxConfig).Should(Equal(newNginxConfig))
|
Expect(nginxConfig).Should(Equal(newNginxConfig))
|
||||||
|
|
||||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "http-svc", 0, nil)
|
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "http-svc", 0, nil)
|
||||||
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync * 2)
|
time.Sleep(waitForLuaSync * 2)
|
||||||
|
@ -129,14 +129,14 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
originalResponseCode := runRequest(f, "scaling.foo.com")
|
originalResponseCode := runRequest(f, "scaling.foo.com")
|
||||||
|
|
||||||
replicas := 2
|
replicas := 2
|
||||||
err := framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, deploymentName, replicas, nil)
|
err := framework.UpdateDeployment(f.KubeClientSet, f.Namespace, deploymentName, replicas, nil)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync * 2)
|
time.Sleep(waitForLuaSync * 2)
|
||||||
|
|
||||||
expectedSuccessResponseCode := runRequest(f, "scaling.foo.com")
|
expectedSuccessResponseCode := runRequest(f, "scaling.foo.com")
|
||||||
|
|
||||||
replicas = 0
|
replicas = 0
|
||||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, deploymentName, replicas, nil)
|
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, deploymentName, replicas, nil)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync * 2)
|
time.Sleep(waitForLuaSync * 2)
|
||||||
|
|
||||||
|
@ -154,11 +154,11 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get("foo.com", metav1.GetOptions{})
|
ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get("foo.com", metav1.GetOptions{})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/load-balance"] = "round_robin"
|
ingress.ObjectMeta.Annotations["nginx.ingress.kubernetes.io/load-balance"] = "round_robin"
|
||||||
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Update(ingress)
|
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ingress)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Get("foo.com", metav1.GetOptions{})
|
ingress, err := f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Get("foo.com", metav1.GetOptions{})
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
ingress.Spec.TLS = []extensions.IngressTLS{
|
ingress.Spec.TLS = []extensions.IngressTLS{
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
ingress.Spec.TLS[0].SecretName,
|
ingress.Spec.TLS[0].SecretName,
|
||||||
ingress.Namespace)
|
ingress.Namespace)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.IngressController.Namespace).Update(ingress)
|
_, err = f.KubeClientSet.ExtensionsV1beta1().Ingresses(f.Namespace).Update(ingress)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
var newNginxConfig string
|
var newNginxConfig string
|
||||||
|
@ -213,7 +213,7 @@ var _ = framework.IngressNginxDescribe("Dynamic Configuration", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(output).Should(Equal(`{"controllerPodsCount":1}`))
|
Expect(output).Should(Equal(`{"controllerPodsCount":1}`))
|
||||||
|
|
||||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 3, nil)
|
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 3, nil)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
time.Sleep(waitForLuaSync)
|
time.Sleep(waitForLuaSync)
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ func ensureIngress(f *framework.Framework, host string, deploymentName string) *
|
||||||
}
|
}
|
||||||
|
|
||||||
func createIngress(f *framework.Framework, host string, deploymentName string) *extensions.Ingress {
|
func createIngress(f *framework.Framework, host string, deploymentName string) *extensions.Ingress {
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, deploymentName, 80,
|
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, deploymentName, 80,
|
||||||
&map[string]string{"nginx.ingress.kubernetes.io/load-balance": "ewma"}))
|
&map[string]string{"nginx.ingress.kubernetes.io/load-balance": "ewma"}))
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -246,7 +246,7 @@ func createIngress(f *framework.Framework, host string, deploymentName string) *
|
||||||
|
|
||||||
func ensureRequest(f *framework.Framework, host string) {
|
func ensureRequest(f *framework.Framework, host string) {
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
@ -255,7 +255,7 @@ func ensureRequest(f *framework.Framework, host string) {
|
||||||
|
|
||||||
func ensureRequestWithStatus(f *framework.Framework, host string, statusCode int) {
|
func ensureRequestWithStatus(f *framework.Framework, host string, statusCode int) {
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
@ -264,7 +264,7 @@ func ensureRequestWithStatus(f *framework.Framework, host string, statusCode int
|
||||||
|
|
||||||
func runRequest(f *framework.Framework, host string) int {
|
func runRequest(f *framework.Framework, host string) int {
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
|
|
@ -44,7 +44,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {
|
||||||
It("should return 503 when backend service does not exist", func() {
|
It("should return 503 when backend service does not exist", func() {
|
||||||
host := "nonexistent.svc.com"
|
host := "nonexistent.svc.com"
|
||||||
|
|
||||||
bi := buildIngressWithNonexistentService(host, f.IngressController.Namespace, "/")
|
bi := buildIngressWithNonexistentService(host, f.Namespace, "/")
|
||||||
f.EnsureIngress(bi)
|
f.EnsureIngress(bi)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
@ -63,7 +63,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {
|
||||||
It("should return 503 when all backend service endpoints are unavailable", func() {
|
It("should return 503 when all backend service endpoints are unavailable", func() {
|
||||||
host := "unavailable.svc.com"
|
host := "unavailable.svc.com"
|
||||||
|
|
||||||
bi, bs := buildIngressWithUnavailableServiceEndpoints(host, f.IngressController.Namespace, "/")
|
bi, bs := buildIngressWithUnavailableServiceEndpoints(host, f.Namespace, "/")
|
||||||
|
|
||||||
svc := f.EnsureService(bs)
|
svc := f.EnsureService(bs)
|
||||||
Expect(svc).NotTo(BeNil())
|
Expect(svc).NotTo(BeNil())
|
||||||
|
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
|
|
|
@ -39,7 +39,7 @@ var _ = framework.IngressNginxDescribe("Configmap change", func() {
|
||||||
It("should reload after an update in the configuration", func() {
|
It("should reload after an update in the configuration", func() {
|
||||||
host := "configmap-change"
|
host := "configmap-change"
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
wlKey := "whitelist-source-range"
|
wlKey := "whitelist-source-range"
|
||||||
|
|
|
@ -37,12 +37,12 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
f.NewEchoDeploymentWithReplicas(1)
|
f.NewEchoDeploymentWithReplicas(1)
|
||||||
|
|
||||||
framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, "--disable-catch-all=true")
|
args = append(args, "--disable-catch-all=true")
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -54,10 +54,10 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
It("should ignore catch all Ingress", func() {
|
It("should ignore catch all Ingress", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
|
|
||||||
ing := framework.NewSingleCatchAllIngress("catch-all", f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleCatchAllIngress("catch-all", f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
ing = framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||||
|
@ -73,7 +73,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
It("should delete Ingress updated to catch-all", func() {
|
It("should delete Ingress updated to catch-all", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -82,13 +82,13 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||||
|
|
||||||
err := framework.UpdateIngress(f.KubeClientSet, f.IngressController.Namespace, host, func(ingress *extensions.Ingress) error {
|
err := framework.UpdateIngress(f.KubeClientSet, f.Namespace, host, func(ingress *extensions.Ingress) error {
|
||||||
ingress.Spec.Rules = nil
|
ingress.Spec.Rules = nil
|
||||||
ingress.Spec.Backend = &extensions.IngressBackend{
|
ingress.Spec.Backend = &extensions.IngressBackend{
|
||||||
ServiceName: "http-svc",
|
ServiceName: "http-svc",
|
||||||
|
@ -103,7 +103,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
@ -113,7 +113,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
It("should allow Ingress with both a default backend and rules", func() {
|
It("should allow Ingress with both a default backend and rules", func() {
|
||||||
host := "foo"
|
host := "foo"
|
||||||
|
|
||||||
ing := framework.NewSingleIngressWithBackendAndRules("not-catch-all", "/rulepath", host, f.IngressController.Namespace, "http-svc", 80, "http-svc", 80, nil)
|
ing := framework.NewSingleIngressWithBackendAndRules("not-catch-all", "/rulepath", host, f.Namespace, "http-svc", 80, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||||
|
@ -121,7 +121,7 @@ var _ = framework.IngressNginxDescribe("Disabled catch-all", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
||||||
|
|
||||||
f.UpdateNginxConfigMapData(setting, "true")
|
f.UpdateNginxConfigMapData(setting, "true")
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
|
@ -55,7 +55,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("X-Forwarded-Port", "1234").
|
Set("X-Forwarded-Port", "1234").
|
||||||
Set("X-Forwarded-Proto", "myproto").
|
Set("X-Forwarded-Proto", "myproto").
|
||||||
|
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
||||||
|
|
||||||
f.UpdateNginxConfigMapData(setting, "false")
|
f.UpdateNginxConfigMapData(setting, "false")
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -84,7 +84,7 @@ var _ = framework.IngressNginxDescribe("X-Forwarded headers", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("X-Forwarded-Port", "1234").
|
Set("X-Forwarded-Port", "1234").
|
||||||
Set("X-Forwarded-Proto", "myproto").
|
Set("X-Forwarded-Proto", "myproto").
|
||||||
|
|
|
@ -61,7 +61,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
||||||
"nginx.ingress.kubernetes.io/configuration-snippet": configSnippet,
|
"nginx.ingress.kubernetes.io/configuration-snippet": configSnippet,
|
||||||
}
|
}
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations))
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(cfg string) bool {
|
func(cfg string) bool {
|
||||||
|
@ -71,7 +71,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
||||||
// Should be blocked
|
// Should be blocked
|
||||||
usIP := "8.8.8.8"
|
usIP := "8.8.8.8"
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("X-Forwarded-For", usIP).
|
Set("X-Forwarded-For", usIP).
|
||||||
End()
|
End()
|
||||||
|
@ -81,7 +81,7 @@ var _ = framework.IngressNginxDescribe("Geoip2", func() {
|
||||||
// Shouldn't be blocked
|
// Shouldn't be blocked
|
||||||
australianIP := "1.1.1.1"
|
australianIP := "1.1.1.1"
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("X-Forwarded-For", australianIP).
|
Set("X-Forwarded-For", australianIP).
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -34,7 +34,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
f.NewEchoDeploymentWithReplicas(1)
|
f.NewEchoDeploymentWithReplicas(1)
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||||
})
|
})
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
|
@ -53,7 +53,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
// This test works for minikube, but may have problems with real kubernetes clusters,
|
// This test works for minikube, but may have problems with real kubernetes clusters,
|
||||||
// especially if connection is done via Internet. In this case, the test should be disabled/removed.
|
// especially if connection is done via Internet. In this case, the test should be disabled/removed.
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
@ -71,7 +71,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
|
|
||||||
// Should be blocked
|
// Should be blocked
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36").
|
Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36").
|
||||||
End()
|
End()
|
||||||
|
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("User-Agent", "AlphaBot").
|
Set("User-Agent", "AlphaBot").
|
||||||
End()
|
End()
|
||||||
|
@ -88,7 +88,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
|
|
||||||
// Shouldn't be blocked
|
// Shouldn't be blocked
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1").
|
Set("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1").
|
||||||
End()
|
End()
|
||||||
|
@ -107,7 +107,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
|
|
||||||
// Should be blocked
|
// Should be blocked
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("Referer", "example.com").
|
Set("Referer", "example.com").
|
||||||
End()
|
End()
|
||||||
|
@ -115,7 +115,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("Referer", "qwerty").
|
Set("Referer", "qwerty").
|
||||||
End()
|
End()
|
||||||
|
@ -124,7 +124,7 @@ var _ = framework.IngressNginxDescribe("Global access block", func() {
|
||||||
|
|
||||||
// Shouldn't be blocked
|
// Shouldn't be blocked
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
Set("Referer", "qwerty123").
|
Set("Referer", "qwerty123").
|
||||||
End()
|
End()
|
||||||
|
|
|
@ -45,11 +45,11 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"kubernetes.io/ingress.class": "testclass",
|
"kubernetes.io/ingress.class": "testclass",
|
||||||
}
|
}
|
||||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
validHost := "bar"
|
validHost := "bar"
|
||||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(func(cfg string) bool {
|
f.WaitForNginxConfiguration(func(cfg string) bool {
|
||||||
|
@ -58,14 +58,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", invalidHost).
|
Set("Host", invalidHost).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", validHost).
|
Set("Host", validHost).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
@ -75,12 +75,12 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
|
|
||||||
Context("With a specific ingress-class", func() {
|
Context("With a specific ingress-class", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, "--ingress-class=testclass")
|
args = append(args, "--ingress-class=testclass")
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -89,14 +89,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
It("should ignore Ingress with no class", func() {
|
It("should ignore Ingress with no class", func() {
|
||||||
invalidHost := "bar"
|
invalidHost := "bar"
|
||||||
|
|
||||||
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.IngressController.Namespace, "http-svc", 80, nil)
|
ing := framework.NewSingleIngress(invalidHost, "/", invalidHost, f.Namespace, "http-svc", 80, nil)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
validHost := "foo"
|
validHost := "foo"
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"kubernetes.io/ingress.class": "testclass",
|
"kubernetes.io/ingress.class": "testclass",
|
||||||
}
|
}
|
||||||
ing = framework.NewSingleIngress(validHost, "/", validHost, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing = framework.NewSingleIngress(validHost, "/", validHost, f.Namespace, "http-svc", 80, &annotations)
|
||||||
f.EnsureIngress(ing)
|
f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(validHost, func(cfg string) bool {
|
f.WaitForNginxServer(validHost, func(cfg string) bool {
|
||||||
|
@ -108,14 +108,14 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", validHost).
|
Set("Host", validHost).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
Expect(resp.StatusCode).Should(Equal(http.StatusOK))
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", invalidHost).
|
Set("Host", invalidHost).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
@ -127,7 +127,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"kubernetes.io/ingress.class": "testclass",
|
"kubernetes.io/ingress.class": "testclass",
|
||||||
}
|
}
|
||||||
ing := framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, &annotations)
|
ing := framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, &annotations)
|
||||||
ing = f.EnsureIngress(ing)
|
ing = f.EnsureIngress(ing)
|
||||||
|
|
||||||
f.WaitForNginxServer(host, func(cfg string) bool {
|
f.WaitForNginxServer(host, func(cfg string) bool {
|
||||||
|
@ -135,7 +135,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
@ -149,7 +149,7 @@ var _ = framework.IngressNginxDescribe("Ingress class", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
Expect(errs).To(BeNil())
|
Expect(errs).To(BeNil())
|
||||||
|
|
|
@ -45,11 +45,11 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
f.NewEchoDeployment()
|
f.NewEchoDeployment()
|
||||||
|
|
||||||
s := f.EnsureSecret(buildSecret(username, password, secretName, f.IngressController.Namespace))
|
s := f.EnsureSecret(buildSecret(username, password, secretName, f.Namespace))
|
||||||
|
|
||||||
f.UpdateNginxConfigMapData(setting, noAuthPath)
|
f.UpdateNginxConfigMapData(setting, noAuthPath)
|
||||||
|
|
||||||
bi := buildBasicAuthIngressWithSecondPath(host, f.IngressController.Namespace, s.Name, noAuthPath)
|
bi := buildBasicAuthIngressWithSecondPath(host, f.Namespace, s.Name, noAuthPath)
|
||||||
f.EnsureIngress(bi)
|
f.EnsureIngress(bi)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, body, errs := gorequest.New().
|
resp, body, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
SetBasicAuth(username, password).
|
SetBasicAuth(username, password).
|
||||||
End()
|
End()
|
||||||
|
@ -95,7 +95,7 @@ var _ = framework.IngressNginxDescribe("No Auth locations", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(fmt.Sprintf("%s/noauth", f.IngressController.HTTPURL)).
|
Get(fmt.Sprintf("%s/noauth", f.GetURL(framework.HTTP))).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -63,12 +63,12 @@ var _ = framework.IngressNginxDescribe("[Serial] Pod Security Policies", func()
|
||||||
Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy")
|
Expect(err).NotTo(HaveOccurred(), "updating ingress controller cluster role to use a pod security policy")
|
||||||
|
|
||||||
// update the deployment just to trigger a rolling update and the use of the security policy
|
// update the deployment just to trigger a rolling update and the use of the security policy
|
||||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, "--v=2")
|
args = append(args, "--v=2")
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -108,7 +108,7 @@ var _ = framework.IngressNginxDescribe("[Serial] Pod Security Policies", func()
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, _ := gorequest.New().
|
resp, _, _ := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
Set("Host", "foo.bar.com").
|
Set("Host", "foo.bar.com").
|
||||||
End()
|
End()
|
||||||
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
Expect(resp.StatusCode).Should(Equal(http.StatusNotFound))
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
@ -37,11 +38,11 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should exist a proxy_host", func() {
|
It("should exist a proxy_host", func() {
|
||||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.IngressController.Namespace)
|
upstreamName := fmt.Sprintf("%v-http-svc-80", f.Namespace)
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||||
}
|
}
|
||||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, "http-svc", 80, &annotations))
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -50,7 +51,8 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", test).
|
Set("Host", test).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
@ -60,13 +62,13 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should exist a proxy_host using the upstream-vhost annotation value", func() {
|
It("should exist a proxy_host using the upstream-vhost annotation value", func() {
|
||||||
upstreamName := fmt.Sprintf("%v-http-svc-80", f.IngressController.Namespace)
|
upstreamName := fmt.Sprintf("%v-http-svc-80", f.Namespace)
|
||||||
upstreamVHost := "different.host"
|
upstreamVHost := "different.host"
|
||||||
annotations := map[string]string{
|
annotations := map[string]string{
|
||||||
"nginx.ingress.kubernetes.io/upstream-vhost": upstreamVHost,
|
"nginx.ingress.kubernetes.io/upstream-vhost": upstreamVHost,
|
||||||
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
"nginx.ingress.kubernetes.io/configuration-snippet": `more_set_headers "Custom-Header: $proxy_host"`,
|
||||||
}
|
}
|
||||||
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.IngressController.Namespace, "http-svc", 80, &annotations))
|
f.EnsureIngress(framework.NewSingleIngress(test, "/", test, f.Namespace, "http-svc", 80, &annotations))
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -75,7 +77,8 @@ var _ = framework.IngressNginxDescribe("Proxy host variable", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPURL).
|
Get(f.GetURL(framework.HTTP)).
|
||||||
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
Set("Host", test).
|
Set("Host", test).
|
||||||
End()
|
End()
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
|
@ -47,7 +46,7 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
|
||||||
|
|
||||||
f.UpdateNginxConfigMapData(setting, "true")
|
f.UpdateNginxConfigMapData(setting, "true")
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -56,11 +55,9 @@ var _ = framework.IngressNginxDescribe("Proxy Protocol", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
ip := f.GetNginxIP()
|
ip := f.GetNginxIP()
|
||||||
port, err := f.GetNginxPort("http")
|
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaning NGINX Port")
|
|
||||||
|
|
||||||
conn, err := net.Dial("tcp", net.JoinHostPort(ip, strconv.Itoa(port)))
|
conn, err := net.Dial("tcp", net.JoinHostPort(ip, "80"))
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error creating connection to %s:%d", ip, port)
|
Expect(err).NotTo(HaveOccurred(), "unexpected error creating connection to %s:80", ip)
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 1234\r\n"
|
header := "PROXY TCP4 192.168.0.1 192.168.0.11 56324 1234\r\n"
|
||||||
|
|
|
@ -41,7 +41,7 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() {
|
||||||
It("should not exists Server header in the response", func() {
|
It("should not exists Server header in the response", func() {
|
||||||
f.UpdateNginxConfigMapData(serverTokens, "false")
|
f.UpdateNginxConfigMapData(serverTokens, "false")
|
||||||
|
|
||||||
f.EnsureIngress(framework.NewSingleIngress(serverTokens, "/", serverTokens, f.IngressController.Namespace, "http-svc", 80, nil))
|
f.EnsureIngress(framework.NewSingleIngress(serverTokens, "/", serverTokens, f.Namespace, "http-svc", 80, nil))
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(cfg string) bool {
|
func(cfg string) bool {
|
||||||
|
@ -56,7 +56,7 @@ var _ = framework.IngressNginxDescribe("Server Tokens", func() {
|
||||||
f.EnsureIngress(&v1beta1.Ingress{
|
f.EnsureIngress(&v1beta1.Ingress{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: serverTokens,
|
Name: serverTokens,
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
Annotations: map[string]string{},
|
Annotations: map[string]string{},
|
||||||
},
|
},
|
||||||
Spec: v1beta1.IngressSpec{
|
Spec: v1beta1.IngressSpec{
|
||||||
|
|
|
@ -54,14 +54,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
// https://www.openssl.org/docs/man1.1.0/apps/ciphers.html - "CIPHER SUITE NAMES"
|
// https://www.openssl.org/docs/man1.1.0/apps/ciphers.html - "CIPHER SUITE NAMES"
|
||||||
testCiphers := "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA"
|
testCiphers := "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA"
|
||||||
|
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
ing.Namespace)
|
ing.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||||
|
|
||||||
By("setting cipher suite")
|
By("setting cipher suite")
|
||||||
f.UpdateNginxConfigMapData(sslCiphers, testCiphers)
|
f.UpdateNginxConfigMapData(sslCiphers, testCiphers)
|
||||||
|
@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(tlsConfig).
|
TLSClientConfig(tlsConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -91,7 +91,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(tlsConfig).
|
TLSClientConfig(tlsConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -107,14 +107,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
hstsIncludeSubdomains := "hsts-include-subdomains"
|
hstsIncludeSubdomains := "hsts-include-subdomains"
|
||||||
hstsPreload := "hsts-preload"
|
hstsPreload := "hsts-preload"
|
||||||
|
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
ing.Namespace)
|
ing.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||||
|
|
||||||
By("setting max-age parameter")
|
By("setting max-age parameter")
|
||||||
f.UpdateNginxConfigMapData(hstsMaxAge, "86400")
|
f.UpdateNginxConfigMapData(hstsMaxAge, "86400")
|
||||||
|
@ -125,7 +125,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(tlsConfig).
|
TLSClientConfig(tlsConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -143,7 +143,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(tlsConfig).
|
TLSClientConfig(tlsConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -161,7 +161,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs = gorequest.New().
|
resp, _, errs = gorequest.New().
|
||||||
Get(f.IngressController.HTTPSURL).
|
Get(f.GetURL(framework.HTTPS)).
|
||||||
TLSClientConfig(tlsConfig).
|
TLSClientConfig(tlsConfig).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
End()
|
End()
|
||||||
|
@ -172,14 +172,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should not use ports during the HTTP to HTTPS redirection", func() {
|
It("should not use ports during the HTTP to HTTPS redirection", func() {
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
ing.Namespace)
|
ing.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -188,7 +188,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(fmt.Sprintf(f.IngressController.HTTPURL)).
|
Get(fmt.Sprintf(f.GetURL(framework.HTTP))).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
@ -202,14 +202,14 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
It("should not use ports or X-Forwarded-Host during the HTTP to HTTPS redirection", func() {
|
It("should not use ports or X-Forwarded-Host during the HTTP to HTTPS redirection", func() {
|
||||||
f.UpdateNginxConfigMapData("use-forwarded-headers", "true")
|
f.UpdateNginxConfigMapData("use-forwarded-headers", "true")
|
||||||
|
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
tlsConfig, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
ing.Namespace)
|
ing.Namespace)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
framework.WaitForTLS(f.IngressController.HTTPSURL, tlsConfig)
|
framework.WaitForTLS(f.GetURL(framework.HTTPS), tlsConfig)
|
||||||
|
|
||||||
f.WaitForNginxServer(host,
|
f.WaitForNginxServer(host,
|
||||||
func(server string) bool {
|
func(server string) bool {
|
||||||
|
@ -218,7 +218,7 @@ var _ = framework.IngressNginxDescribe("Settings - TLS)", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(fmt.Sprintf(f.IngressController.HTTPURL)).
|
Get(fmt.Sprintf(f.GetURL(framework.HTTP))).
|
||||||
Retry(10, 1*time.Second, http.StatusNotFound).
|
Retry(10, 1*time.Second, http.StatusNotFound).
|
||||||
RedirectPolicy(noRedirectPolicyFunc).
|
RedirectPolicy(noRedirectPolicyFunc).
|
||||||
Set("Host", host).
|
Set("Host", host).
|
||||||
|
|
|
@ -45,14 +45,14 @@ var _ = framework.IngressNginxDescribe("SSL", func() {
|
||||||
dummySecret := f.EnsureSecret(&v1.Secret{
|
dummySecret := f.EnsureSecret(&v1.Secret{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "dummy",
|
Name: "dummy",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"key": []byte("value"),
|
"key": []byte("value"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngressWithTLS(host, "/", host, []string{host}, f.Namespace, "http-svc", 80, nil))
|
||||||
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
_, err := framework.CreateIngressTLSSecret(f.KubeClientSet,
|
||||||
ing.Spec.TLS[0].Hosts,
|
ing.Spec.TLS[0].Hosts,
|
||||||
ing.Spec.TLS[0].SecretName,
|
ing.Spec.TLS[0].SecretName,
|
||||||
|
@ -69,12 +69,12 @@ var _ = framework.IngressNginxDescribe("SSL", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(log).ToNot(BeEmpty())
|
Expect(log).ToNot(BeEmpty())
|
||||||
|
|
||||||
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("starting syncing of secret %v/dummy", f.IngressController.Namespace)))
|
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("starting syncing of secret %v/dummy", f.Namespace)))
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
dummySecret.Data["some-key"] = []byte("some value")
|
dummySecret.Data["some-key"] = []byte("some value")
|
||||||
f.KubeClientSet.CoreV1().Secrets(f.IngressController.Namespace).Update(dummySecret)
|
f.KubeClientSet.CoreV1().Secrets(f.Namespace).Update(dummySecret)
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("starting syncing of secret %v/dummy", f.IngressController.Namespace)))
|
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("starting syncing of secret %v/dummy", f.Namespace)))
|
||||||
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("error obtaining PEM from secret %v/dummy", f.IngressController.Namespace)))
|
Expect(log).ToNot(ContainSubstring(fmt.Sprintf("error obtaining PEM from secret %v/dummy", f.Namespace)))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -49,7 +49,7 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
|
||||||
port, cmd, err := f.KubectlProxy(0)
|
port, cmd, err := f.KubectlProxy(0)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error starting kubectl proxy")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error starting kubectl proxy")
|
||||||
|
|
||||||
err = framework.UpdateDeployment(f.KubeClientSet, f.IngressController.Namespace, "nginx-ingress-controller", 1,
|
err = framework.UpdateDeployment(f.KubeClientSet, f.Namespace, "nginx-ingress-controller", 1,
|
||||||
func(deployment *appsv1beta1.Deployment) error {
|
func(deployment *appsv1beta1.Deployment) error {
|
||||||
args := deployment.Spec.Template.Spec.Containers[0].Args
|
args := deployment.Spec.Template.Spec.Containers[0].Args
|
||||||
args = append(args, fmt.Sprintf("--apiserver-host=http://%s:%d", address.String(), port))
|
args = append(args, fmt.Sprintf("--apiserver-host=http://%s:%d", address.String(), port))
|
||||||
|
@ -67,14 +67,14 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
deployment.Spec.Template.Spec.Containers[0].Args = args
|
deployment.Spec.Template.Spec.Containers[0].Args = args
|
||||||
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.IngressController.Namespace).Update(deployment)
|
_, err := f.KubeClientSet.AppsV1beta1().Deployments(f.Namespace).Update(deployment)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error updating ingress controller deployment flags")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error updating ingress controller deployment flags")
|
||||||
|
|
||||||
f.NewEchoDeploymentWithReplicas(1)
|
f.NewEchoDeploymentWithReplicas(1)
|
||||||
|
|
||||||
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.IngressController.Namespace, "http-svc", 80, nil))
|
ing := f.EnsureIngress(framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil))
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(cfg string) bool {
|
func(cfg string) bool {
|
||||||
|
@ -87,16 +87,16 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
|
||||||
err = cmd.Process.Kill()
|
err = cmd.Process.Kill()
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error terminating kubectl proxy")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error terminating kubectl proxy")
|
||||||
|
|
||||||
ing, err = f.KubeClientSet.Extensions().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err = f.KubeClientSet.Extensions().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error getting %s/%v Ingress", f.IngressController.Namespace, host)
|
Expect(err).NotTo(HaveOccurred(), "unexpected error getting %s/%v Ingress", f.Namespace, host)
|
||||||
|
|
||||||
ing.Status.LoadBalancer.Ingress = []apiv1.LoadBalancerIngress{}
|
ing.Status.LoadBalancer.Ingress = []apiv1.LoadBalancerIngress{}
|
||||||
_, err = f.KubeClientSet.Extensions().Ingresses(f.IngressController.Namespace).UpdateStatus(ing)
|
_, err = f.KubeClientSet.Extensions().Ingresses(f.Namespace).UpdateStatus(ing)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error cleaning Ingress status")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error cleaning Ingress status")
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(10 * time.Second)
|
||||||
|
|
||||||
err = f.KubeClientSet.CoreV1().
|
err = f.KubeClientSet.CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Delete("ingress-controller-leader-nginx", &metav1.DeleteOptions{})
|
Delete("ingress-controller-leader-nginx", &metav1.DeleteOptions{})
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error deleting leader election configmap")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error deleting leader election configmap")
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@ var _ = framework.IngressNginxDescribe("Status Update [Status]", func() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = wait.Poll(10*time.Second, framework.DefaultTimeout, func() (done bool, err error) {
|
err = wait.Poll(10*time.Second, framework.DefaultTimeout, func() (done bool, err error) {
|
||||||
ing, err = f.KubeClientSet.Extensions().Ingresses(f.IngressController.Namespace).Get(host, metav1.GetOptions{})
|
ing, err = f.KubeClientSet.Extensions().Ingresses(f.Namespace).Get(host, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ing.Status.LoadBalancer.Ingress) != 1 {
|
if len(ing.Status.LoadBalancer.Ingress) != 1 {
|
||||||
|
|
|
@ -19,11 +19,12 @@ package settings
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/parnurzeal/gorequest"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/parnurzeal/gorequest"
|
||||||
|
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/intstr"
|
"k8s.io/apimachinery/pkg/util/intstr"
|
||||||
|
@ -52,7 +53,7 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
|
|
||||||
config, err := f.KubeClientSet.
|
config, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Get("tcp-services", metav1.GetOptions{})
|
Get("tcp-services", metav1.GetOptions{})
|
||||||
Expect(err).To(BeNil(), "unexpected error obtaining tcp-services configmap")
|
Expect(err).To(BeNil(), "unexpected error obtaining tcp-services configmap")
|
||||||
Expect(config).NotTo(BeNil(), "expected a configmap but none returned")
|
Expect(config).NotTo(BeNil(), "expected a configmap but none returned")
|
||||||
|
@ -61,17 +62,17 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
config.Data = map[string]string{}
|
config.Data = map[string]string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Data["8080"] = fmt.Sprintf("%v/http-svc:80", f.IngressController.Namespace)
|
config.Data["8080"] = fmt.Sprintf("%v/http-svc:80", f.Namespace)
|
||||||
|
|
||||||
_, err = f.KubeClientSet.
|
_, err = f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Update(config)
|
Update(config)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error updating configmap")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error updating configmap")
|
||||||
|
|
||||||
svc, err := f.KubeClientSet.
|
svc, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
Services(f.IngressController.Namespace).
|
Services(f.Namespace).
|
||||||
Get("ingress-nginx", metav1.GetOptions{})
|
Get("ingress-nginx", metav1.GetOptions{})
|
||||||
Expect(err).To(BeNil(), "unexpected error obtaining ingress-nginx service")
|
Expect(err).To(BeNil(), "unexpected error obtaining ingress-nginx service")
|
||||||
Expect(svc).NotTo(BeNil(), "expected a service but none returned")
|
Expect(svc).NotTo(BeNil(), "expected a service but none returned")
|
||||||
|
@ -83,21 +84,18 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
})
|
})
|
||||||
_, err = f.KubeClientSet.
|
_, err = f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
Services(f.IngressController.Namespace).
|
Services(f.Namespace).
|
||||||
Update(svc)
|
Update(svc)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error updating service")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error updating service")
|
||||||
|
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(cfg string) bool {
|
func(cfg string) bool {
|
||||||
return strings.Contains(cfg, fmt.Sprintf(`ngx.var.proxy_upstream_name="tcp-%v-http-svc-80"`, f.IngressController.Namespace))
|
return strings.Contains(cfg, fmt.Sprintf(`ngx.var.proxy_upstream_name="tcp-%v-http-svc-80"`, f.Namespace))
|
||||||
})
|
})
|
||||||
|
|
||||||
ip := f.GetNginxIP()
|
ip := f.GetNginxIP()
|
||||||
port, err := f.GetNginxPort("http-svc")
|
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaining service port")
|
|
||||||
|
|
||||||
resp, _, errs := gorequest.New().
|
resp, _, errs := gorequest.New().
|
||||||
Get(fmt.Sprintf("http://%v:%v", ip, port)).
|
Get(fmt.Sprintf("http://%v:8080", ip)).
|
||||||
End()
|
End()
|
||||||
Expect(errs).Should(BeEmpty())
|
Expect(errs).Should(BeEmpty())
|
||||||
Expect(resp.StatusCode).Should(Equal(200))
|
Expect(resp.StatusCode).Should(Equal(200))
|
||||||
|
@ -113,7 +111,7 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
externalService := &corev1.Service{
|
externalService := &corev1.Service{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "dns-external-name-svc",
|
Name: "dns-external-name-svc",
|
||||||
Namespace: f.IngressController.Namespace,
|
Namespace: f.Namespace,
|
||||||
},
|
},
|
||||||
|
|
||||||
Spec: corev1.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
|
@ -133,7 +131,7 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
// Expose the `external name` port on the `ingress-nginx` service
|
// Expose the `external name` port on the `ingress-nginx` service
|
||||||
svc, err := f.KubeClientSet.
|
svc, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
Services(f.IngressController.Namespace).
|
Services(f.Namespace).
|
||||||
Get("ingress-nginx", metav1.GetOptions{})
|
Get("ingress-nginx", metav1.GetOptions{})
|
||||||
Expect(err).To(BeNil(), "unexpected error obtaining ingress-nginx service")
|
Expect(err).To(BeNil(), "unexpected error obtaining ingress-nginx service")
|
||||||
Expect(svc).NotTo(BeNil(), "expected a service but none returned")
|
Expect(svc).NotTo(BeNil(), "expected a service but none returned")
|
||||||
|
@ -145,14 +143,14 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
})
|
})
|
||||||
_, err = f.KubeClientSet.
|
_, err = f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
Services(f.IngressController.Namespace).
|
Services(f.Namespace).
|
||||||
Update(svc)
|
Update(svc)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error updating service")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error updating service")
|
||||||
|
|
||||||
// Update the TCP configmap to link port 5353 to the DNS external name service
|
// Update the TCP configmap to link port 5353 to the DNS external name service
|
||||||
config, err := f.KubeClientSet.
|
config, err := f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Get("tcp-services", metav1.GetOptions{})
|
Get("tcp-services", metav1.GetOptions{})
|
||||||
Expect(err).To(BeNil(), "unexpected error obtaining tcp-services configmap")
|
Expect(err).To(BeNil(), "unexpected error obtaining tcp-services configmap")
|
||||||
Expect(config).NotTo(BeNil(), "expected a configmap but none returned")
|
Expect(config).NotTo(BeNil(), "expected a configmap but none returned")
|
||||||
|
@ -161,11 +159,11 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
config.Data = map[string]string{}
|
config.Data = map[string]string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Data["5353"] = fmt.Sprintf("%v/dns-external-name-svc:5353", f.IngressController.Namespace)
|
config.Data["5353"] = fmt.Sprintf("%v/dns-external-name-svc:5353", f.Namespace)
|
||||||
|
|
||||||
_, err = f.KubeClientSet.
|
_, err = f.KubeClientSet.
|
||||||
CoreV1().
|
CoreV1().
|
||||||
ConfigMaps(f.IngressController.Namespace).
|
ConfigMaps(f.Namespace).
|
||||||
Update(config)
|
Update(config)
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error updating configmap")
|
Expect(err).NotTo(HaveOccurred(), "unexpected error updating configmap")
|
||||||
|
|
||||||
|
@ -174,19 +172,16 @@ var _ = framework.IngressNginxDescribe("TCP Feature", func() {
|
||||||
// Validate that the generated nginx config contains the expected `proxy_upstream_name` value
|
// Validate that the generated nginx config contains the expected `proxy_upstream_name` value
|
||||||
f.WaitForNginxConfiguration(
|
f.WaitForNginxConfiguration(
|
||||||
func(cfg string) bool {
|
func(cfg string) bool {
|
||||||
return strings.Contains(cfg, fmt.Sprintf(`ngx.var.proxy_upstream_name="tcp-%v-dns-external-name-svc-5353"`, f.IngressController.Namespace))
|
return strings.Contains(cfg, fmt.Sprintf(`ngx.var.proxy_upstream_name="tcp-%v-dns-external-name-svc-5353"`, f.Namespace))
|
||||||
})
|
})
|
||||||
|
|
||||||
// Execute the test. Use the `external name` service to resolve a domain name.
|
// Execute the test. Use the `external name` service to resolve a domain name.
|
||||||
ip := f.GetNginxIP()
|
ip := f.GetNginxIP()
|
||||||
port, err := f.GetNginxPort("dns-svc")
|
|
||||||
Expect(err).NotTo(HaveOccurred(), "unexpected error obtaining service port")
|
|
||||||
|
|
||||||
resolver := net.Resolver{
|
resolver := net.Resolver{
|
||||||
PreferGo: true,
|
PreferGo: true,
|
||||||
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||||
d := net.Dialer{}
|
d := net.Dialer{}
|
||||||
return d.DialContext(ctx, "tcp", fmt.Sprintf("%v:%v", ip, port))
|
return d.DialContext(ctx, "tcp", fmt.Sprintf("%v:5353", ip))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ips, err := resolver.LookupHost(context.Background(), "google-public-dns-b.google.com")
|
ips, err := resolver.LookupHost(context.Background(), "google-public-dns-b.google.com")
|
||||||
|
|
|
@ -22,13 +22,12 @@ if test -e kubectl; then
|
||||||
echo "skipping download of kubectl"
|
echo "skipping download of kubectl"
|
||||||
else
|
else
|
||||||
echo "downloading kubectl..."
|
echo "downloading kubectl..."
|
||||||
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl && \
|
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.3/bin/linux/amd64/kubectl \
|
||||||
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
|
&& chmod +x kubectl && sudo mv kubectl /usr/local/bin/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ${HOME}/.kube
|
export KUBECONFIG="$(mktemp)"
|
||||||
touch ${HOME}/.kube/config
|
echo -n ${KUBECONFIG} > /tmp/kubeconfig
|
||||||
export KUBECONFIG=${HOME}/.kube/config
|
|
||||||
|
|
||||||
echo "starting Kubernetes cluster..."
|
echo "starting Kubernetes cluster..."
|
||||||
K8S_VERSION=v1.11
|
K8S_VERSION=v1.11
|
||||||
|
@ -54,3 +53,6 @@ make -C ${DIR}/../../ build container
|
||||||
echo "copying docker image to cluster..."
|
echo "copying docker image to cluster..."
|
||||||
DEV_IMAGE=${REGISTRY}/nginx-ingress-controller:${TAG}
|
DEV_IMAGE=${REGISTRY}/nginx-ingress-controller:${TAG}
|
||||||
${DIR}/dind-cluster-v1.11.sh copy-image ${DEV_IMAGE}
|
${DIR}/dind-cluster-v1.11.sh copy-image ${DEV_IMAGE}
|
||||||
|
|
||||||
|
echo "copying e2e docker image to cluster..."
|
||||||
|
${DIR}/dind-cluster-v1.11.sh copy-image nginx-ingress-controller:e2e
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
@ -32,8 +33,10 @@ function on_exit {
|
||||||
}
|
}
|
||||||
trap on_exit EXIT
|
trap on_exit EXIT
|
||||||
|
|
||||||
sed "s@\${NAMESPACE}@${NAMESPACE}@" $DIR/../manifests/ingress-controller/mandatory.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
kubectl apply --namespace=$NAMESPACE -f $DIR/manifests/service.yaml
|
||||||
cat $DIR/../manifests/ingress-controller/service-nodeport.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
|
||||||
|
sed "s@\${NAMESPACE}@${NAMESPACE}@" $DIR/manifests/mandatory.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
||||||
|
cat $DIR/manifests/service.yaml | kubectl apply --namespace=$NAMESPACE -f -
|
||||||
|
|
||||||
# wait for the deployment and fail if there is an error before starting the execution of any test
|
# wait for the deployment and fail if there is an error before starting the execution of any test
|
||||||
kubectl rollout status \
|
kubectl rollout status \
|
||||||
|
|
Loading…
Reference in a new issue