Compare commits

...

7 Commits

Author SHA1 Message Date
Simon Belmas
8d91a5b6e8 Analyse: added binary http connection status to ease post analysis 2024-06-28 10:04:05 +02:00
Simon Belmas
9110390246 Improoved statistics gathering 2024-06-27 16:38:50 +02:00
Simon Belmas
f2b52c4e6e update gitignore to ignore all csv 2024-06-27 15:50:22 +02:00
Simon Belmas
b635dd74f2 add ingress statistics generation script 2024-06-27 15:04:16 +02:00
Simon Belmas
14483b7428 add links to json and text files 2024-06-27 14:58:56 +02:00
Simon Belmas
13dc53688d adding txt file to store node name 2024-06-27 14:55:36 +02:00
Simon Belmas
60048f74c7 Add ingress + ingress sample and documentation 2024-06-27 12:14:30 +02:00
7 changed files with 97 additions and 7 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**.csv

View File

@@ -1,13 +1,27 @@
# html-kube-tester
## Workload
Workload to test application behavior while making changes on infrastructure.
Ingress is not included and have to be added on top.
Feel free to customize *replicas* and *content-git-repo* in *config* folder.
Ingress fqdn has to be configured by either:
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*
Nnode name is displayed on the top of the page and also in kube-node.json
*replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch
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.
## 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
View 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

View File

@@ -21,7 +21,8 @@ cat <<EOF >index.html
</head>
<body>
<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>
<iframe
id="embeddedcontent"
@@ -34,4 +35,4 @@ cat <<EOF >index.html
EOF
echo '{"node": "'${KUBE_NODE_NAME}'"}' > kube-node.json
echo -n ${KUBE_NODE_NAME} > kube-node.txt

View File

@@ -0,0 +1,4 @@
- op: replace
path: /spec/rules/0/host
value: html-kube-tester.example.com

20
ingress.yaml Normal file
View 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:
- {}

View File

@@ -17,6 +17,7 @@ resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
replacements:
- source:
@@ -29,3 +30,9 @@ replacements:
name: html-kube-tester
fieldPaths:
- spec.replicas
patches:
- path: ingress-patch-route-name.yaml
target:
kind: Ingress
name: run