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
b6e3eb73
Commit
b6e3eb73
authored
Jun 07, 2023
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an e2e test for the use of ShardParam in a BackendConfig.
parent
b7d31fea
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
111 additions
and
10 deletions
+111
-10
Makefile
examples/backend-config/Makefile
+32
-7
backend-cfg.yaml
examples/backend-config/backend-cfg.yaml
+0
-1
cafe-param.vtc
examples/backend-config/cafe-param.vtc
+19
-0
values-param.yaml
examples/backend-config/values-param.yaml
+58
-0
values.yaml
examples/backend-config/values.yaml
+0
-1
verify.sh
examples/backend-config/verify.sh
+2
-1
No files found.
examples/backend-config/Makefile
View file @
b6e3eb73
...
...
@@ -34,18 +34,25 @@ TESTDIR=$(mkdir)/../../test
all
:
deploy
deploy-helm
:
deploy-
bcfg-
helm
:
@
helm
install
viking-ingress-backend-cfg
$(CHARTDIR)
/viking-test-app
\
--values
values.yaml
deploy-param-helm
:
@
helm
install
viking-ingress-shard-param
$(CHARTDIR)
/viking-test-app
\
--values
values-param.yaml
deploy-kubectl
:
@
kubectl apply
-f
$(mkdir)
/../hello/cafe-ingress.yaml
@
kubectl apply
-f
backend-cfg.yaml
@
kubectl apply
-f
$(mkdir)
/../hello/cafe.yaml
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify
:
$(mkdir)
/verify.sh
verify-bcfg
:
$(mkdir)
/verify.sh cafe.vtc
verify-param
:
$(mkdir)
/verify.sh cafe-param.vtc
wait
:
$(TESTDIR)
/wait.sh
app
=
varnish-ingress
...
...
@@ -55,19 +62,37 @@ uninstall-kubectl:
@
kubectl delete
-f
$(mkdir)
/../hello/cafe-ingress.yaml
@
kubectl delete
-f
$(mkdir)
/../hello/cafe.yaml
uninstall-helm
:
uninstall-
bcfg-
helm
:
@
helm uninstall viking-ingress-backend-cfg
uninstall-param-helm
:
@
helm uninstall viking-ingress-shard-param
undeploy-kubectl
:
uninstall-kubectl wait
undeploy-helm
:
uninstall-helm wait
undeploy-bcfg-helm
:
uninstall-bcfg-helm wait
undeploy-param-helm
:
uninstall-param-helm wait
ifeq
($(DEPLOY),kubectl)
deploy
:
deploy-kubectl
undeploy
:
undeploy-kubectl
verify
:
verify-bcfg
else
deploy-bcfg
:
deploy-bcfg-helm
undeploy-bcfg
:
undeploy-bcfg-helm
deploy-param
:
deploy-param-helm
undeploy-param
:
undeploy-param-helm
endif
ifeq
($(EXAMPLE),param)
deploy
:
deploy-param
undeploy
:
undeploy-param
verify
:
verify-param
else
deploy
:
deploy-helm
undeploy
:
undeploy-helm
deploy
:
deploy-bcfg
undeploy
:
undeploy-bcfg
verify
:
verify-bcfg
endif
.PHONY
:
all $(MAKECMDGOALS)
examples/backend-config/backend-cfg.yaml
View file @
b6e3eb73
...
...
@@ -82,6 +82,5 @@ spec:
# would be sharded if the "first" Endpoint were to be removed.
# - Requests for newly added Endpoints ramp up over five minutes.
type
:
shard
shard_param
:
caffeine
warmup
:
50
rampup
:
5m
examples/backend-config/cafe-param.vtc
0 → 100644
View file @
b6e3eb73
# looks like -*- vcl -*-
varnishtest "cafe example using shard_param objects"
client c1 -connect "${localhost} ${localport}" {
txreq -url /coffee/foo/bar -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.http.X-Caffeine-Warmup == "0.250"
expect resp.http.X-Caffeine-Rampup == "true"
} -run
client c1 -connect "${localhost} ${localport}" {
txreq -url /tea/baz/quux -hdr "Host: cafe.example.com"
rxresp
expect resp.status == 200
expect resp.http.X-Theobromine-Warmup == "0.750"
expect resp.http.X-Theobromine-Rampup == "false"
} -run
examples/backend-config/values-param.yaml
0 → 100644
View file @
b6e3eb73
apps
:
coffee
:
image
:
uplex/http-echo
replicas
:
2
servicePort
:
80
containerPort
:
7357
targetPort
:
7357
config
:
director
:
type
:
shard
shard_param
:
caffeine
tea
:
image
:
uplex/http-echo
replicas
:
3
servicePort
:
80
containerPort
:
7357
targetPort
:
7357
config
:
director
:
type
:
shard
shard_param
:
theobromine
ingress
:
name
:
cafe-ingress
rules
:
-
host
:
cafe.example.com
paths
:
-
path
:
/tea
type
:
Prefix
app
:
tea
-
path
:
/coffee
type
:
Prefix
app
:
coffee
vikingAdmSvc
:
varnish-ingress-admin
vcl
:
|
sub vcl_init {
vk8s_default_2f_coffee-svc_director.associate(caffeine.use());
vk8s_default_2f_tea-svc_director.associate(theobromine.use());
}
sub vcl_backend_fetch {
caffeine.set(warmup=0.25, rampup=true);
theobromine.set(warmup=0.75, rampup=false);
set bereq.http.X-Caffeine-Warmup = caffeine.get_warmup();
set bereq.http.X-Caffeine-Rampup = caffeine.get_rampup();
set bereq.http.X-Theobromine-Warmup = theobromine.get_warmup();
set bereq.http.X-Theobromine-Rampup = theobromine.get_rampup();
}
sub vcl_backend_response {
set beresp.http.X-Caffeine-Warmup = bereq.http.X-Caffeine-Warmup;
set beresp.http.X-Caffeine-Rampup = bereq.http.X-Caffeine-Rampup;
set beresp.http.X-Theobromine-Warmup = bereq.http.X-Theobromine-Warmup;
set beresp.http.X-Theobromine-Rampup = bereq.http.X-Theobromine-Rampup;
}
examples/backend-config/values.yaml
View file @
b6e3eb73
...
...
@@ -28,7 +28,6 @@ apps:
# would be sharded if the "first" Endpoint were to be removed.
# - Requests for newly added Endpoints ramp up over five minutes.
type
:
shard
shard_param
:
caffeine
warmup
:
50
rampup
:
5m
...
...
examples/backend-config/verify.sh
View file @
b6e3eb73
#! /bin/bash -ex
MYDIR
=
$(
dirname
${
BASH_SOURCE
[0]
})
VTC
=
$1
source
${
MYDIR
}
/../../test/utils.sh
LOCALPORT
=
${
LOCALPORT
:-
8888
}
...
...
@@ -15,4 +16,4 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
trap
'kill $(jobs -p)'
EXIT
wait_for_port
${
LOCALPORT
}
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
cafe.vtc
varnishtest
${
TESTOPTS
}
-Dlocalport
=
${
LOCALPORT
}
${
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