Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
ded4b7fa
Commit
ded4b7fa
authored
Feb 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automate un-/deployment & test of the multi-controller example.
parent
fd5f3373
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
0 deletions
+138
-0
cafe.vtc
examples/architectures/multi-controller/cafe.vtc
+25
-0
controller.yaml
examples/architectures/multi-controller/controller.yaml
+1
-0
deploy.sh
examples/architectures/multi-controller/deploy.sh
+28
-0
undeploy.sh
examples/architectures/multi-controller/undeploy.sh
+28
-0
verify.sh
examples/architectures/multi-controller/verify.sh
+56
-0
No files found.
examples/architectures/multi-controller/cafe.vtc
0 → 100644
View file @
ded4b7fa
# looks like -*- vcl -*-
varnishtest "cafe example, multiple Ingress controllers"
client c1 -connect "${localhost} ${coffeeport}" {
txreq -url /foo -hdr "Host: coffee.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
txreq -url /foo -hdr "Host: tea.example.com"
rxresp
expect resp.status == 404
} -run
client c1 -connect "${localhost} ${teaport}" {
txreq -url /bar -hdr "Host: tea.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^Server name: tea-[a-z0-9]+-[a-z0-9]+$"
txreq -url /bar -hdr "Host: coffee.example.com"
rxresp
expect resp.status == 404
} -run
examples/architectures/multi-controller/controller.yaml
View file @
ded4b7fa
...
...
@@ -12,6 +12,7 @@ spec:
metadata
:
labels
:
app
:
varnish-ingress-controller
example
:
coffee
spec
:
serviceAccountName
:
varnish-ingress-controller
containers
:
...
...
examples/architectures/multi-controller/deploy.sh
0 → 100755
View file @
ded4b7fa
#! /bin/bash -ex
# Assumes that the kube-system controller as configured in deploy/ is
# already deployed.
kubectl apply
-f
controller.yaml
kubectl apply
-f
namespace.yaml
kubectl apply
-f
coffee.yaml
kubectl apply
-f
tea.yaml
kubectl apply
-f
adm-secret-tea.yaml
kubectl apply
-f
nodeport-tea.yaml
kubectl apply
-f
varnish-tea.yaml
kubectl apply
-f
adm-secret-coffee.yaml
kubectl apply
-f
nodeport-coffee.yaml
kubectl apply
-f
varnish-coffee.yaml
kubectl apply
-f
coffee-ingress.yaml
kubectl apply
-f
tea-ingress.yaml
examples/architectures/multi-controller/undeploy.sh
0 → 100755
View file @
ded4b7fa
#! /bin/bash -ex
kubectl delete
-f
tea-ingress.yaml
kubectl delete
-f
coffee-ingress.yaml
kubectl delete
-f
varnish-coffee.yaml
kubectl delete
-f
nodeport-coffee.yaml
kubectl delete
-f
adm-secret-coffee.yaml
kubectl delete
-f
varnish-tea.yaml
kubectl delete
-f
nodeport-tea.yaml
kubectl delete
-f
adm-secret-tea.yaml
kubectl delete
-f
tea.yaml
kubectl delete
-f
coffee.yaml
kubectl delete
-f
namespace.yaml
kubectl delete
-f
controller.yaml
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress-controller,example
=
coffee
\
-n
kube-system
--for
=
delete
examples/architectures/multi-controller/verify.sh
0 → 100755
View file @
ded4b7fa
#! /bin/bash -ex
function
killcoffee
{
kill
$COFFEEPID
}
function
killcafe
{
kill
$COFFEEPID
kill
$TEAPID
}
COFFEEPORT
=
${
COFFEEPORT
:-
8888
}
TEAPORT
=
${
TEAPORT
:-
9999
}
kubectl
wait
-n
kube-system
--timeout
=
2m pod
-l
app
=
varnish-ingress-controller
\
--for
=
condition
=
Ready
kubectl
wait
-n
cafe
--timeout
=
2m pod
-l
app
=
varnish-ingress
\
--for
=
condition
=
Ready
kubectl port-forward
-n
cafe svc/varnish-coffee
${
COFFEEPORT
}
:80
>
/dev/null &
COFFEEPID
=
$!
trap
killcoffee EXIT
kubectl port-forward
-n
cafe svc/varnish-tea
${
TEAPORT
}
:80
>
/dev/null &
TEAPID
=
$!
trap
killcafe EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dcoffeeport
=
${
COFFEEPORT
}
-Dteaport
=
${
TEAPORT
}
cafe.vtc
# Parse the tea controller log for these lines:
# Ingress class:varnish
# Ingress cafe/tea-ingress configured for Varnish Service cafe/varnish-tea
# Ignoring Ingress cafe/coffee-ingress, Annotation 'kubernetes.io/ingress.class' absent or is not 'varnish'
# Get the name of the tea controller Pod
CTLPOD
=
$(
kubectl get pods
-n
kube-system
-l
app
=
varnish-ingress-controller,example!
=
coffee
-o
jsonpath
={
.items[0].metadata.name
}
)
# Match the logs
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
'Ingress class:varnish'
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
'Ingress cafe/tea-ingress configured for Varnish Service cafe/varnish-tea'
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
"Ignoring Ingress cafe/coffee-ingress, Annotation 'kubernetes.io/ingress.class' absent or is not 'varnish'"
# Parse the coffee controller log for these lines
# Ingress class:varnish-coffee
# Ingress cafe/coffee-ingress configured for Varnish Service cafe/varnish-coffee
# Ignoring Ingress cafe/tea-ingress, Annotation 'kubernetes.io/ingress.class' absent or is not 'varnish-coffee'
# Get the name of the tea controller Pod
CTLPOD
=
$(
kubectl get pods
-n
kube-system
-l
app
=
varnish-ingress-controller
-l
example
=
coffee
-o
jsonpath
={
.items[0].metadata.name
}
)
# Match the logs
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
'Ingress class:varnish-coffee'
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
'Ingress cafe/coffee-ingress configured for Varnish Service cafe/varnish-coffee'
kubectl logs
-n
kube-system
$CTLPOD
|
grep
-q
"Ignoring Ingress cafe/tea-ingress, Annotation 'kubernetes.io/ingress.class' absent or is not 'varnish-coffee'"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment