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
b89b0d53
Commit
b89b0d53
authored
Aug 26, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run the Pod template tests with helm, driven by a Makefile.
parent
8f6e194f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
343 additions
and
15 deletions
+343
-15
Makefile
examples/varnish_pod_template/Makefile
+220
-0
cli-args.yaml
examples/varnish_pod_template/cli-args.yaml
+1
-1
env.yaml
examples/varnish_pod_template/env.yaml
+1
-1
proxy.yaml
examples/varnish_pod_template/proxy.yaml
+1
-1
values-cli-args-varnish.yaml
examples/varnish_pod_template/values-cli-args-varnish.yaml
+22
-0
values-env-varnish.yaml
examples/varnish_pod_template/values-env-varnish.yaml
+47
-0
values-proxy-varnish.yaml
examples/varnish_pod_template/values-proxy-varnish.yaml
+18
-0
values.yaml
examples/varnish_pod_template/values.yaml
+19
-0
verify_cli-args.sh
examples/varnish_pod_template/verify_cli-args.sh
+1
-3
verify_env.sh
examples/varnish_pod_template/verify_env.sh
+1
-1
verify_proxy.sh
examples/varnish_pod_template/verify_proxy.sh
+1
-8
wait_delete.sh
examples/varnish_pod_template/wait_delete.sh
+11
-0
No files found.
examples/varnish_pod_template/Makefile
0 → 100644
View file @
b89b0d53
# Copyright (c) 2020 UPLEX Nils Goroll Systemoptimierung
# All rights reserved
#
# Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# GNU make is required.
mkpath
:=
$
(
abspath
$
(
lastword
$(MAKEFILE_LIST)
))
mkdir
:=
$
(
dir
$(mkpath)
)
CHARTDIR
=
$(mkdir)
/../../charts
# For the klarlack image: make VARNISH=klarlack ...
ifndef
VARNISH
VARNISH
=
varnish
endif
CI_REPO_PFX
=
registry.gitlab.com/uplex/varnish/k8s-ingress/varnish-ingress
# For tests using the local docker registry: make TEST=local ...
# For tests using images from the CI pipeline: make TEST=ci ...
ifeq
($(TEST),local)
CONTROLLER_IMAGE
=
varnish-ingress/controller
CONTROLLER_TAG
=
latest
VARNISH_IMAGE
=
varnish-ingress/
$(VARNISH)
VARNISH_TAG
=
latest
HAPROXY_IMAGE
=
varnish-ingress/haproxy
HAPROXY_TAG
=
latest
else
ifeq
($(TEST),ci)
CONTROLLER_IMAGE
=
$(CI_REPO_PFX)
/controller
CONTROLLER_TAG
=
master
VARNISH_IMAGE
=
$(CI_REPO_PFX)
/
$(VARNISH)
VARNISH_TAG
=
master
HAPROXY_IMAGE
=
$(CI_REPO_PFX)
/haproxy
HAPROXY_TAG
=
master
endif
# If not specified, pull the latest "official" images from dockerhub.
LATEST
=
0.0.2
ifndef
CONTROLLER_IMAGE
CONTROLLER_IMAGE
=
uplex/viking-controller
endif
ifndef
CONTROLLER_TAG
CONTROLLER_TAG
=
$(LATEST)
endif
ifndef
VARNISH_IMAGE
VARNISH_IMAGE
=
uplex/viking-
$(VARNISH)
endif
ifndef
VARNISH_TAG
VARNISH_TAG
=
$(LATEST)
endif
ifndef
HAPROXY_IMAGE
HAPROXY_IMAGE
=
uplex/viking-haproxy
endif
ifndef
HAPROXY_TAG
HAPROXY_TAG
=
$(LATEST)
endif
all
:
deploy
deploy-cli-args-helm
:
@
helm
install
viking-service-cli-args
$(CHARTDIR)
/viking-service
\
--values
values-cli-args-varnish.yaml
\
--set
vikingService.varnish.image.repository
=
$(VARNISH_IMAGE)
\
--set
vikingService.varnish.image.tag
=
$(VARNISH_TAG)
\
--set
vikingService.haproxy.image.repository
=
$(HAPROXY_IMAGE)
\
--set
vikingService.haproxy.image.tag
=
$(HAPROXY_TAG)
@
helm
install
viking-ingress-cli-args
$(CHARTDIR)
/viking-test-app
\
--values
values.yaml
deploy-proxy-helm
:
@
helm
install
viking-service-proxy
$(CHARTDIR)
/viking-service
\
--values
values-proxy-varnish.yaml
\
--set
vikingService.varnish.image.repository
=
$(VARNISH_IMAGE)
\
--set
vikingService.varnish.image.tag
=
$(VARNISH_TAG)
\
--set
vikingService.haproxy.image.repository
=
$(HAPROXY_IMAGE)
\
--set
vikingService.haproxy.image.tag
=
$(HAPROXY_TAG)
@
helm
install
viking-ingress-proxy
$(CHARTDIR)
/viking-test-app
\
--values
values.yaml
deploy-env-helm
:
@
helm
install
viking-service-env
$(CHARTDIR)
/viking-service
\
--values
values-env-varnish.yaml
\
--set
vikingService.varnish.image.repository
=
$(VARNISH_IMAGE)
\
--set
vikingService.varnish.image.tag
=
$(VARNISH_TAG)
\
--set
vikingService.haproxy.image.repository
=
$(HAPROXY_IMAGE)
\
--set
vikingService.haproxy.image.tag
=
$(HAPROXY_TAG)
@
helm
install
viking-ingress-env
$(CHARTDIR)
/viking-test-app
\
--values
values.yaml
deploy-cli-args-kubectl
:
@
kubectl apply
-f
../hello/cafe.yaml
@
kubectl apply
-f
cafe-ingress.yaml
@
kubectl apply
-f
cli-args.yaml
deploy-proxy-kubectl
:
@
kubectl apply
-f
../hello/cafe.yaml
@
kubectl apply
-f
cafe-ingress.yaml
@
kubectl apply
-f
proxy.yaml
deploy-env-kubectl
:
@
kubectl apply
-f
../hello/cafe.yaml
@
kubectl apply
-f
cafe-ingress.yaml
@
kubectl apply
-f
env.yaml
# TESTOPTS are passed to varnishtest, e.g.: make TESTOPTS=-v verify
verify-cli-args
:
$(mkdir)
/verify_cli-args.sh
verify-proxy
:
$(mkdir)
/verify_proxy.sh
verify-env
:
$(mkdir)
/verify_env.sh
undeploy-cli-args-kubectl
:
@
kubectl delete
-f
cli-args.yaml
@
kubectl delete
-f
cafe-ingress.yaml
@
kubectl delete
-f
../hello/cafe.yaml
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
cli-args
undeploy-proxy-kubectl
:
@
kubectl delete
-f
proxy.yaml
@
kubectl delete
-f
cafe-ingress.yaml
@
kubectl delete
-f
../hello/cafe.yaml
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
proxy
undeploy-env-kubectl
:
@
kubectl delete
-f
env.yaml
@
kubectl delete
-f
cafe-ingress.yaml
@
kubectl delete
-f
../hello/cafe.yaml
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
env
undeploy-cli-args-helm
:
@
helm uninstall viking-ingress-cli-args
@
helm uninstall viking-service-cli-args
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
cli-args
undeploy-proxy-helm
:
@
helm uninstall viking-ingress-proxy
@
helm uninstall viking-service-proxy
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
proxy
undeploy-env-helm
:
@
helm uninstall viking-ingress-env
@
helm uninstall viking-service-env
$(mkdir)
/wait_delete.sh
app
=
varnish-ingress,example
=
env
deploy-cli-args
:
deploy-proxy
:
deploy-env
:
undeploy-cli-args
:
undeploy-proxy
:
undeploy-env
:
ifeq
($(DEPLOY),kubectl)
deploy-cli-args
:
deploy-cli-args-kubectl
deploy-proxy
:
deploy-proxy-kubectl
deploy-env
:
deploy-env-kubectl
undeploy-cli-args
:
undeploy-cli-args-kubectl
undeploy-proxy
:
undeploy-proxy-kubectl
undeploy-env
:
undeploy-env-kubectl
else
deploy-cli-args
:
deploy-cli-args-helm
deploy-proxy
:
deploy-proxy-helm
deploy-env
:
deploy-env-helm
undeploy-cli-args
:
undeploy-cli-args-helm
undeploy-proxy
:
undeploy-proxy-helm
undeploy-env
:
undeploy-env-helm
endif
deploy
:
verify
:
undeploy
:
ifeq
($(EXAMPLE),cli-args)
deploy
:
deploy-cli-args
verify
:
verify-cli-args
undeploy
:
undeploy-cli-args
else
ifeq
($(EXAMPLE),proxy)
deploy
:
deploy-proxy
verify
:
verify-proxy
undeploy
:
undeploy-proxy
else
ifeq
($(EXAMPLE),env)
deploy
:
deploy-env
verify
:
verify-env
undeploy
:
undeploy-env
else
$(error
EXAMPLE
must
be
set
to
cli-args,
proxy,
or
env)
endif
.PHONY
:
all $(MAKECMDGOALS)
examples/varnish_pod_template/cli-args.yaml
View file @
b89b0d53
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
pod-template-examples
-svc
name
:
pod-template-examples
labels
:
app
:
varnish-ingress
spec
:
...
...
examples/varnish_pod_template/env.yaml
View file @
b89b0d53
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
pod-template-examples
-svc
name
:
pod-template-examples
labels
:
app
:
varnish-ingress
spec
:
...
...
examples/varnish_pod_template/proxy.yaml
View file @
b89b0d53
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
pod-template-examples
-svc
name
:
pod-template-examples
labels
:
app
:
varnish-ingress
spec
:
...
...
examples/varnish_pod_template/values-cli-args-varnish.yaml
0 → 100644
View file @
b89b0d53
nameOverride
:
pod-template-examples
fullnameOverride
:
pod-template-examples
vikingService
:
varnish
:
extraArgs
:
-
-s
-
malloc,256m
-
-t
-
"
900"
-
-p
-
workspace_client=256k
## Name of the ingress class to route through this controller
##
ingressClass
:
varnish
replicaCount
:
1
# labels to add to the pod container metadata
podLabels
:
app
:
varnish-ingress
example
:
cli-args
examples/varnish_pod_template/values-env-varnish.yaml
0 → 100644
View file @
b89b0d53
nameOverride
:
pod-template-examples
fullnameOverride
:
pod-template-examples
vikingService
:
varnish
:
extraEnvs
:
-
name
:
PROTO
value
:
PROXY
-
name
:
HTTP_PORT
value
:
"
81"
-
name
:
READY_PORT
value
:
"
8000"
-
name
:
ADMIN_PORT
value
:
"
7000"
-
name
:
CONFIG_PORT
value
:
"
9000"
-
name
:
SECRET_PATH
value
:
/var/secret
-
name
:
SECRET_FILE
value
:
adm.secret
admSecret
:
path
:
/var/secret
file
:
adm.secret
service
:
ports
:
http
:
81
httpTarget
:
81
varnishadm
:
7000
ready
:
8000
config
:
9000
haproxy
:
extraEnvs
:
-
name
:
VARNISH_READY_PORT
value
:
"
8000"
## Name of the ingress class to route through this controller
##
ingressClass
:
varnish
replicaCount
:
1
# labels to add to the pod container metadata
podLabels
:
app
:
varnish-ingress
example
:
env
examples/varnish_pod_template/values-proxy-varnish.yaml
0 → 100644
View file @
b89b0d53
nameOverride
:
pod-template-examples
fullnameOverride
:
pod-template-examples
vikingService
:
varnish
:
extraEnvs
:
-
name
:
PROTO
value
:
PROXY
## Name of the ingress class to route through this controller
##
ingressClass
:
varnish
replicaCount
:
1
# labels to add to the pod container metadata
podLabels
:
app
:
varnish-ingress
example
:
proxy
examples/varnish_pod_template/values.yaml
0 → 100644
View file @
b89b0d53
apps
:
coffee
:
image
:
nginxdemos/hello:plain-text
replicas
:
2
tea
:
image
:
nginxdemos/hello:plain-text
replicas
:
3
ingress
:
name
:
cafe-ingress
rules
:
-
host
:
cafe.example.com
paths
:
-
path
:
/tea
app
:
tea
-
path
:
/coffee
app
:
coffee
vikingAdmSvc
:
pod-template-examples-admin
examples/varnish_pod_template/verify_cli-args.sh
View file @
b89b0d53
...
...
@@ -5,13 +5,11 @@ source ${MYDIR}/../../test/utils.sh
LOCALPORT
=
${
LOCALPORT
:-
8888
}
# wait_until_deleted app=varnish-ingress,example!=cli-args
set
-e
wait_until_ready
example
=
cli-args
wait_until_configured
example
=
cli-args
kubectl port-forward svc/pod-template-examples
-svc
${
LOCALPORT
}
:80
>
/dev/null &
kubectl port-forward svc/pod-template-examples
${
LOCALPORT
}
:80
>
/dev/null &
trap
'kill $(jobs -p)'
EXIT
wait_for_port
${
LOCALPORT
}
...
...
examples/varnish_pod_template/verify_env.sh
View file @
b89b0d53
...
...
@@ -10,7 +10,7 @@ wait_until_ready example=env
# Config check is at non-default port 9000.
wait_until_configured
example
=
env
default 120 9000
kubectl port-forward svc/pod-template-examples
-svc
${
LOCALPORT
}
:81
>
/dev/null &
kubectl port-forward svc/pod-template-examples
${
LOCALPORT
}
:81
>
/dev/null &
trap
'kill $(jobs -p)'
EXIT
wait_for_port
${
LOCALPORT
}
...
...
examples/varnish_pod_template/verify_proxy.sh
View file @
b89b0d53
#! /bin/bash -x
function
dump_controller_log
{
echo
"error status
$?
"
local
pod
=(
$(
kubectl get pods
-n
kube-system
-l
app
=
varnish-ingress-controller
--no-headers
-o
custom-columns
=
":metadata.name"
)
)
kubectl logs
-n
kube-system
${
pod
}
}
MYDIR
=
$(
dirname
${
BASH_SOURCE
[0]
})
source
${
MYDIR
}
/../../test/utils.sh
LOCALPORT
=
${
LOCALPORT
:-
8888
}
set
-e
# trap dump_controller_log ERR
wait_until_ready
example
=
proxy
wait_until_configured
example
=
proxy
kubectl port-forward svc/pod-template-examples
-svc
${
LOCALPORT
}
:80
>
/dev/null &
kubectl port-forward svc/pod-template-examples
${
LOCALPORT
}
:80
>
/dev/null &
trap
'kill $(jobs -p)'
EXIT
wait_for_port
${
LOCALPORT
}
...
...
examples/varnish_pod_template/wait_delete.sh
0 → 100755
View file @
b89b0d53
#! /bin/bash -ex
if
[
-z
"
$1
"
]
||
[
"$#"
-gt
3
]
;
then
echo
"Usage:
$0
label [namespace] [timeout]"
exit
1
fi
MYDIR
=
$(
dirname
${
BASH_SOURCE
[0]
})
source
${
MYDIR
}
/../../test/utils.sh
wait_until_deleted
"
$@
"
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