Compare commits
7 Commits
c3d8cf38b4
...
8d91a5b6e8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d91a5b6e8 | ||
|
|
9110390246 | ||
|
|
f2b52c4e6e | ||
|
|
b635dd74f2 | ||
|
|
14483b7428 | ||
|
|
13dc53688d | ||
|
|
60048f74c7 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
**.csv
|
||||||
22
README.md
22
README.md
@@ -1,13 +1,27 @@
|
|||||||
# html-kube-tester
|
# html-kube-tester
|
||||||
|
|
||||||
|
## Workload
|
||||||
|
|
||||||
Workload to test application behavior while making changes on infrastructure.
|
Workload to test application behavior while making changes on infrastructure.
|
||||||
|
|
||||||
Ingress is not included and have to be added on top.
|
Ingress fqdn has to be configured by either:
|
||||||
Feel free to customize *replicas* and *content-git-repo* in *config* folder.
|
|
||||||
|
|
||||||
Git will be displayed in an iframe with node name on top.
|
* modifying file *ingress-patch-route-name.yaml*
|
||||||
|
* using this repo as kustomize source and override inn the same way than *ingress-patch-route-name.yaml*
|
||||||
|
|
||||||
|
*replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch
|
||||||
|
|
||||||
Nnode name is displayed on the top of the page and also in kube-node.json
|
Connntent git will be displayed in an iframe with node name on top.
|
||||||
|
|
||||||
|
Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt
|
||||||
|
|
||||||
Thanks to https://github.com/amoldalwai/RoadFighter.git for having something fun to display.
|
Thanks to https://github.com/amoldalwai/RoadFighter.git for having something fun to display.
|
||||||
|
|
||||||
|
## Analyse script
|
||||||
|
|
||||||
|
A script is given to test inngress availability.
|
||||||
|
analyse.sh {ingress fqdn} [keep_results]
|
||||||
|
|
||||||
|
Option *keep_results* does not ovewrite file on startup.
|
||||||
|
|
||||||
|
Information is displayed in csv format: date (epoch) | request total time | response http code | page successfully reached (0/1) | response conntent
|
||||||
43
analyse.sh
Executable file
43
analyse.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/zsh -e
|
||||||
|
|
||||||
|
# This script asserts that init.sh workload script is left as is.
|
||||||
|
|
||||||
|
|
||||||
|
script_dir=$(dirname $(readlink -f ${0}))
|
||||||
|
results_file=${script_dir}/analyse_results.csv
|
||||||
|
tmp_headers_file=${script_dir}/analyse_request_headers
|
||||||
|
|
||||||
|
if [[ -z "${1}" ]] ; then
|
||||||
|
echo "First parameter must be url"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
analyse_url=${1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${2}" == "keep_results" ]] ; then
|
||||||
|
keep_results=true
|
||||||
|
else
|
||||||
|
keep_results=false
|
||||||
|
echo '' > ${results_file}
|
||||||
|
fi
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ -e "${tmp_headers_file}" ] ; then
|
||||||
|
rm -v ${tmp_headers_file}
|
||||||
|
fi
|
||||||
|
echo Ingress statistics can be viewed in ${results_file}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Launching test, press CTRL+C to exit
|
||||||
|
|
||||||
|
# Defining cleannup onn sigint
|
||||||
|
trap cleanup 2
|
||||||
|
|
||||||
|
while true ; do
|
||||||
|
request_date=$(date '+%s')
|
||||||
|
request_data="$(curl -m 2 -s -w "%output{$tmp_headers_file}%{time_total};%{http_code}" -k "${analyse_url}" | tr -d "\r" |tr -d "\n" | tr -d ";")"
|
||||||
|
request_headers=$(cat ${tmp_headers_file})
|
||||||
|
response_success=$( [[ "$(echo ${request_headers} | cut -f2 -d';')" == "200" ]] && echo 1 || echo 0)
|
||||||
|
echo "${request_date};${request_headers};${response_success};${request_data}" | tee -a ${results_file}
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
@@ -21,7 +21,8 @@ cat <<EOF >index.html
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
From node ${KUBE_NODE_NAME}
|
From node ${KUBE_NODE_NAME}<br />
|
||||||
|
as <a href="./kube-node.json">json</a> - <a href="./kube-node.txt">text</a>
|
||||||
</p>
|
</p>
|
||||||
<iframe
|
<iframe
|
||||||
id="embeddedcontent"
|
id="embeddedcontent"
|
||||||
@@ -34,4 +35,4 @@ cat <<EOF >index.html
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo '{"node": "'${KUBE_NODE_NAME}'"}' > kube-node.json
|
echo '{"node": "'${KUBE_NODE_NAME}'"}' > kube-node.json
|
||||||
|
echo -n ${KUBE_NODE_NAME} > kube-node.txt
|
||||||
|
|||||||
4
ingress-patch-route-name.yaml
Normal file
4
ingress-patch-route-name.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
- op: replace
|
||||||
|
path: /spec/rules/0/host
|
||||||
|
value: html-kube-tester.example.com
|
||||||
20
ingress.yaml
Normal file
20
ingress.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: run
|
||||||
|
annotations:
|
||||||
|
route.openshift.io/termination: "edge"
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: my.app.example.com
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- backend:
|
||||||
|
service:
|
||||||
|
name: html-kube-tester
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
path: /
|
||||||
|
pathType: Prefix
|
||||||
|
tls:
|
||||||
|
- {}
|
||||||
@@ -17,6 +17,7 @@ resources:
|
|||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
|
- ingress.yaml
|
||||||
|
|
||||||
replacements:
|
replacements:
|
||||||
- source:
|
- source:
|
||||||
@@ -28,4 +29,10 @@ replacements:
|
|||||||
kind: Deployment
|
kind: Deployment
|
||||||
name: html-kube-tester
|
name: html-kube-tester
|
||||||
fieldPaths:
|
fieldPaths:
|
||||||
- spec.replicas
|
- spec.replicas
|
||||||
|
|
||||||
|
patches:
|
||||||
|
- path: ingress-patch-route-name.yaml
|
||||||
|
target:
|
||||||
|
kind: Ingress
|
||||||
|
name: run
|
||||||
Reference in New Issue
Block a user