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
36e6de41
Commit
36e6de41
authored
Feb 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automate un-/deployment & test of the cluster & ns Ingress example.
parent
18c6a221
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
0 deletions
+127
-0
cafe.vtc
examples/architectures/cluster-and-ns-wide/cafe.vtc
+26
-0
deploy.sh
examples/architectures/cluster-and-ns-wide/deploy.sh
+27
-0
undeploy.sh
examples/architectures/cluster-and-ns-wide/undeploy.sh
+30
-0
verify.sh
examples/architectures/cluster-and-ns-wide/verify.sh
+44
-0
No files found.
examples/architectures/cluster-and-ns-wide/cafe.vtc
0 → 100644
View file @
36e6de41
# looks like -*- vcl -*-
varnishtest "cafe example, cluster-wide and namespace-specific Services"
client c1 -connect "${localhost} ${systemport}" {
txreq -url /foo -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: anything.else"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^Server name: other-[a-z0-9]+-[a-z0-9]+$"
} -run
client c1 -connect "${localhost} ${cafeport}" {
txreq -url /coffee -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
examples/architectures/cluster-and-ns-wide/deploy.sh
0 → 100755
View file @
36e6de41
#! /bin/bash -ex
kubectl apply
-f
namespace.yaml
kubectl apply
-f
coffee.yaml
kubectl apply
-f
tea.yaml
kubectl apply
-f
other.yaml
kubectl apply
-f
adm-secret-system.yaml
kubectl apply
-f
nodeport-system.yaml
kubectl apply
-f
varnish-system.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
kubectl apply
-f
other-ingress.yaml
examples/architectures/cluster-and-ns-wide/undeploy.sh
0 → 100755
View file @
36e6de41
#! /bin/bash -ex
kubectl delete
-f
other-ingress.yaml
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-system.yaml
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
-n
kube-system
\
--for
=
delete
kubectl delete
-f
nodeport-system.yaml
kubectl delete
-f
adm-secret-system.yaml
kubectl delete
-f
other.yaml
kubectl delete
-f
tea.yaml
kubectl delete
-f
coffee.yaml
kubectl delete
-f
namespace.yaml
examples/architectures/cluster-and-ns-wide/verify.sh
0 → 100755
View file @
36e6de41
#! /bin/bash -ex
function
killsystem
{
kill
$SYSTEMPID
}
function
killcafe
{
kill
$SYSTEMPID
kill
$CAFEPID
}
SYSTEMPORT
=
${
SYSTEMPORT
:-
8888
}
CAFEPORT
=
${
CAFEPORT
:-
9999
}
kubectl
wait
-n
kube-system
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl
wait
-n
cafe
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward
-n
kube-system svc/varnish-ingress
${
SYSTEMPORT
}
:80
>
/dev/null &
SYSTEMPID
=
$!
trap
killsystem EXIT
kubectl port-forward
-n
cafe svc/varnish-ingress
${
CAFEPORT
}
:80
>
/dev/null &
CAFEPID
=
$!
trap
killcafe EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dsystemport
=
${
SYSTEMPORT
}
-Dcafeport
=
${
CAFEPORT
}
cafe.vtc
# Parse the controller log for these lines (Ingress names in any order):
# Ingresses implemented by Varnish Service kube-system/varnish-ingress: [other/other-ingress cafe/tea-ingress]
# Ingresses implemented by Varnish Service cafe/varnish-ingress: [cafe/coffee-ingress]
# Get the name of the controller Pod
CTLPOD
=
$(
kubectl get pods
-n
kube-system
-l
app
=
varnish-ingress-controller
-o
jsonpath
={
.items[0].metadata.name
}
)
# Extract the last matching lines
SYSINGS
=
$(
kubectl logs
-n
kube-system
$CTLPOD
|
grep
'Ingresses implemented by Varnish Service kube-system/varnish-ingress'
|
tail
-1
)
CAFEINGS
=
$(
kubectl logs
-n
kube-system
$CTLPOD
|
grep
'Ingresses implemented by Varnish Service cafe/varnish-ingress'
|
tail
-1
)
# Check those line for the Ingress names
echo
$SYSINGS
|
grep
'other/other-ingress'
echo
$SYSINGS
|
grep
'cafe/tea-ingress'
echo
$CAFEINGS
|
grep
'cafe/coffee-ingress'
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