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
f9051e18
Commit
f9051e18
authored
Feb 07, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automate un-/deployment & test of the request disposition examples.
parent
2af30bfb
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
487 additions
and
0 deletions
+487
-0
cafe_alt-builtin.vtc
examples/req-disposition/cafe_alt-builtin.vtc
+53
-0
cafe_builtin.vtc
examples/req-disposition/cafe_builtin.vtc
+48
-0
cafe_cacheability.vtc
examples/req-disposition/cafe_cacheability.vtc
+22
-0
cafe_pass-on-session-cookie.vtc
examples/req-disposition/cafe_pass-on-session-cookie.vtc
+51
-0
cafe_purge.vtc
examples/req-disposition/cafe_purge.vtc
+10
-0
cafe_url-whitelist.vtc
examples/req-disposition/cafe_url-whitelist.vtc
+33
-0
deploy_alt-builtin.sh
examples/req-disposition/deploy_alt-builtin.sh
+7
-0
deploy_builtin.sh
examples/req-disposition/deploy_builtin.sh
+7
-0
deploy_cacheability.sh
examples/req-disposition/deploy_cacheability.sh
+7
-0
deploy_pass-on-session-cookie.sh
examples/req-disposition/deploy_pass-on-session-cookie.sh
+7
-0
deploy_purge.sh
examples/req-disposition/deploy_purge.sh
+7
-0
deploy_url-whitelist.sh
examples/req-disposition/deploy_url-whitelist.sh
+7
-0
undeploy_alt-builtin.sh
examples/req-disposition/undeploy_alt-builtin.sh
+22
-0
undeploy_builtin.sh
examples/req-disposition/undeploy_builtin.sh
+22
-0
undeploy_cacheability.sh
examples/req-disposition/undeploy_cacheability.sh
+22
-0
undeploy_pass-on-session-cookie.sh
examples/req-disposition/undeploy_pass-on-session-cookie.sh
+22
-0
undeploy_purge.sh
examples/req-disposition/undeploy_purge.sh
+22
-0
undeploy_url-whitelist.sh
examples/req-disposition/undeploy_url-whitelist.sh
+22
-0
verify_alt-builtin.sh
examples/req-disposition/verify_alt-builtin.sh
+16
-0
verify_builtin.sh
examples/req-disposition/verify_builtin.sh
+16
-0
verify_cacheability.sh
examples/req-disposition/verify_cacheability.sh
+16
-0
verify_pass-on-session-cookie.sh
examples/req-disposition/verify_pass-on-session-cookie.sh
+16
-0
verify_purge.sh
examples/req-disposition/verify_purge.sh
+16
-0
verify_url-whitelist.sh
examples/req-disposition/verify_url-whitelist.sh
+16
-0
No files found.
examples/req-disposition/cafe_alt-builtin.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, alternative reconstruction of builtin vcl_recv"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /coffee$"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
txreq -url /tea -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /tea$"
expect resp.body ~ "(?m)^Server name: tea-[a-z0-9]+-[a-z0-9]+$"
txreq -url /beer
rxresp
expect resp.status == 404
txreq -req PRI -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 405
expect resp.reason == "Method Not Allowed"
txreq -req HACK -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 405
expect resp.reason == "Method Not Allowed"
txreq -url /coffee -nohost
rxresp
expect resp.status == 400
expect resp.reason == "Bad Request"
txreq -req PUT -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /coffee -hdr "Host: cafe.example.com" \
-hdr "Cookie: foo=bar"
rxresp
expect resp.status == 200
} -run
## Pipe currently fails, not routed to a backend.
# client c1 -connect "${localhost} ${localport}" {
# txreq -req CONNECT -url /coffee -hdr "Host: cafe.example.com" \
# -hdr "Connection: close"
# rxresp
# expect resp.status == 200
# } -run
examples/req-disposition/cafe_builtin.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, req-disposition reconstructs builtin vcl_recv"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /coffee$"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
txreq -url /tea -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /tea$"
expect resp.body ~ "(?m)^Server name: tea-[a-z0-9]+-[a-z0-9]+$"
txreq -url /beer
rxresp
expect resp.status == 404
txreq -req PRI -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 405
expect resp.reason == "Method Not Allowed"
txreq -url /coffee -nohost
rxresp
expect resp.status == 400
expect resp.reason == "Bad Request"
txreq -req PUT -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /coffee -hdr "Host: cafe.example.com" \
-hdr "Cookie: foo=bar"
rxresp
expect resp.status == 200
} -run
## Pipe currently fails, not routed to a backend.
# client c1 -connect "${localhost} ${localport}" {
# txreq -req CONNECT -url /coffee -hdr "Host: cafe.example.com" \
# -hdr "Connection: close"
# rxresp
# expect resp.status == 200
# } -run
examples/req-disposition/cafe_cacheability.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, cacheability rules based on URL patterns"
client c1 -connect "${localhost} ${localport}" {
# XXX verify pass or lookup
txreq -url /coffee/black.js -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /tea/sugar.css -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /interactive/foo/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 404
txreq -url /dynamic/baz/quux -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 404
} -run
examples/req-disposition/cafe_pass-on-session-cookie.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, pass on some cookies but not others"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /coffee$"
expect resp.body ~ "(?m)^Server name: coffee-[a-z0-9]+-[a-z0-9]+$"
txreq -url /tea -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.body ~ "(?m)^URI: /tea$"
expect resp.body ~ "(?m)^Server name: tea-[a-z0-9]+-[a-z0-9]+$"
txreq -url /beer
rxresp
expect resp.status == 404
txreq -req PRI -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 405
expect resp.reason == "Method Not Allowed"
txreq -url /coffee -nohost
rxresp
expect resp.status == 400
expect resp.reason == "Bad Request"
txreq -req PUT -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
# XXX verify pass or lookup
txreq -url /coffee -hdr "Host: cafe.example.com" \
-hdr "Cookie: SESSIONID=0123456789abcdef0123456789abcdef"
rxresp
expect resp.status == 200
txreq -url /coffee -hdr "Host: cafe.example.com" \
-hdr "Cookie: LOGIN=foobar"
rxresp
expect resp.status == 200
txreq -url /coffee -hdr "Host: cafe.example.com" \
-hdr "Cookie: foo=bar"
rxresp
expect resp.status == 200
} -run
examples/req-disposition/cafe_purge.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, PURGE method"
client c1 -connect "${localhost} ${localport}" {
txreq -req PURGE -url /coffee -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.reason == "Purged"
} -run
examples/req-disposition/cafe_url-whitelist.vtc
0 → 100644
View file @
f9051e18
# looks like -*- vcl -*-
varnishtest "cafe example, white-/blacklisting based on URL patterns"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee/sugar/foo -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /tea/sugar/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
txreq -url /coffee/baz -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 403
expect resp.reason == "Forbidden"
txreq -url /tea/quux -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 403
expect resp.reason == "Forbidden"
txreq -url /coffee/sugar/black/foo -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 403
expect resp.reason == "Blacklisted"
txreq -url /tea/sugar/black/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 403
expect resp.reason == "Blacklisted"
} -run
examples/req-disposition/deploy_alt-builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
alt-builtin.yaml
examples/req-disposition/deploy_builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
builtin.yaml
examples/req-disposition/deploy_cacheability.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
cacheability.yaml
examples/req-disposition/deploy_pass-on-session-cookie.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
pass-on-session-cookie.yaml
examples/req-disposition/deploy_purge.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
purge-method.yaml
examples/req-disposition/deploy_url-whitelist.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl apply
-f
../hello/cafe.yaml
kubectl apply
-f
../hello/cafe-ingress.yaml
kubectl apply
-f
url-whitelist.yaml
examples/req-disposition/undeploy_alt-builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
alt-builtin.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/undeploy_builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
builtin.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/undeploy_cacheability.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
cacheability.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/undeploy_pass-on-session-cookie.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
pass-on-session-cookie.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/undeploy_purge.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
purge-method.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/undeploy_url-whitelist.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
kubectl delete
-f
url-whitelist.yaml
kubectl delete
-f
../hello/cafe-ingress.yaml
kubectl delete
-f
../hello/cafe.yaml
echo
"Waiting until varnish-ingress Pods are not ready"
N
=
0
until
[
$N
-ge
120
]
do
if
kubectl get pods
-l
app
=
varnish-ingress |
grep
-q
' 1/1'
;
then
sleep
10
N
=
$((
N
+
10
))
continue
fi
exit
0
done
echo
"Giving up"
exit
1
examples/req-disposition/verify_alt-builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_alt-builtin.vtc
examples/req-disposition/verify_builtin.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_builtin.vtc
examples/req-disposition/verify_cacheability.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_cacheability.vtc
examples/req-disposition/verify_pass-on-session-cookie.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_pass-on-session-cookie.vtc
examples/req-disposition/verify_purge.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_purge.vtc
examples/req-disposition/verify_url-whitelist.sh
0 → 100755
View file @
f9051e18
#! /bin/bash -ex
function
killforward
{
kill
$KUBEPID
}
LOCALPORT
=
${
LOCALPORT
:-
8888
}
kubectl
wait
--timeout
=
2m pod
-l
app
=
varnish-ingress
--for
=
condition
=
Ready
kubectl port-forward svc/varnish-ingress
${
LOCALPORT
}
:80
>
/dev/null &
KUBEPID
=
$!
trap
killforward EXIT
sleep
1
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe_url-whitelist.vtc
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