1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

demo: make demo runnable again

Fix workload template specs:
- update node affinity in "demo-pod-with-discovery.cloverleaf"
- fix broken "demo-pod-without-discovery"

Fix runner scripts to be runnable from anywhere gqYour current working
dir shouldn't matter. Also make the scripts exit on any error. Also
remove trailing whitespace.

Minor fixes in README.
This commit is contained in:
Markus Lehtonen 2020-09-10 09:39:46 +03:00
parent 868699445f
commit 02d68ba491
7 changed files with 74 additions and 70 deletions

View file

@ -30,7 +30,7 @@ While our example illustrates the benefits of using node feature discovery with
Scripts to reproduce our demo results can be found in [helper-scripts](helper-scripts/). Scripts to reproduce our demo results can be found in [helper-scripts](helper-scripts/).
### Prerequisites ### Prerequisites
1. `Kubectl` should be configured properly to work with your Kubernetes cluster. 1. `kubectl` should be configured properly to work with your Kubernetes cluster.
2. Node feature discovery should have been already deployed on your Kubernetes cluster. 2. Node feature discovery should have been already deployed on your Kubernetes cluster.
### Instructions ### Instructions
@ -41,8 +41,8 @@ Follow these easy steps to reproduce the demo.
3. `./run-with-discovery.sh -a cloverleaf` 3. `./run-with-discovery.sh -a cloverleaf`
4. `./run-without-discovery.sh -a parsec` 4. `./run-without-discovery.sh -a parsec`
5. `./run-without-discovery.sh -a cloverleaf` 5. `./run-without-discovery.sh -a cloverleaf`
6. `/aggregate-logs-and-plot.sh -a parsec` 6. `./aggregate-logs-and-plot.sh -a parsec`
7. `/aggregate-logs-and-plot.sh -a cloverleaf` 7. `./aggregate-logs-and-plot.sh -a cloverleaf`
Following the above steps will produce the performance and normalized performance logs and their corresponding plots for each application. Following the above steps will produce the performance and normalized performance logs and their corresponding plots for each application.

View file

@ -1,7 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
show_help() {
set -eo pipefail
this=`basename $0`
this_dir=`dirname $0`
show_help() {
cat << EOF cat << EOF
Usage: ${0##*/} [-a APPLICATION_NAME] Usage: $this [-a APPLICATION_NAME]
Aggregate the results from the specified application and plot the result. Aggregate the results from the specified application and plot the result.
-a APPLICATION_NAME run the pods with APPLICATION_NAME application. -a APPLICATION_NAME run the pods with APPLICATION_NAME application.
@ -21,7 +27,7 @@ OPTIND=1
options="ha:" options="ha:"
while getopts $options option while getopts $options option
do do
case $option in case $option in
a) a)
if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ] if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ]
then then
@ -32,11 +38,11 @@ do
exit 0 exit 0
fi fi
;; ;;
h) h)
show_help show_help
exit 0 exit 0
;; ;;
'?') '?')
show_help show_help
exit 1 exit 1
;; ;;
@ -59,7 +65,7 @@ rm -f temp.log labels-with-discovery-$app.log
minimum=$(awk 'min=="" || $2 < min {min=$2} END {print min}' performance.log) minimum=$(awk 'min=="" || $2 < min {min=$2} END {print min}' performance.log)
awk -v min=$minimum '{print $1,((($2/min)*100))-100}' performance.log > performance-norm.log awk -v min=$minimum '{print $1,((($2/min)*100))-100}' performance.log > performance-norm.log
./box-plot.R performance.log performance-comparison-$app.pdf "$this_dir/box-plot.R" performance.log performance-comparison-$app.pdf
./box-plot-norm.R performance-norm.log performance-comparison-$app-norm.pdf "$this_dir/box-plot-norm.R" performance-norm.log performance-comparison-$app-norm.pdf
./clean-up.sh -a $app "$this_dir/clean-up.sh" -a $app

View file

@ -1,8 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
show_help() {
set -eo pipefail
this=`basename $0`
show_help() {
cat << EOF cat << EOF
Usage: ${0##*/} [-a APPLICATION_NAME] Usage: $this [-a APPLICATION_NAME]
Clean-up pods with and without discovery enabled for the specified application. Clean-up pods with and without discovery enabled for the specified application.
-a APPLICATION_NAME clean-up the pods with APPLICATION_NAME application. -a APPLICATION_NAME clean-up the pods with APPLICATION_NAME application.
APPLICATION_NAME can be one of parsec or cloverleaf. APPLICATION_NAME can be one of parsec or cloverleaf.
@ -21,7 +26,7 @@ OPTIND=1
options="ha:" options="ha:"
while getopts $options option while getopts $options option
do do
case $option in case $option in
a) a)
if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ] if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ]
then then
@ -32,11 +37,11 @@ do
exit 0 exit 0
fi fi
;; ;;
h) h)
show_help show_help
exit 0 exit 0
;; ;;
'?') '?')
show_help show_help
exit 1 exit 1
;; ;;
@ -45,11 +50,11 @@ done
echo "Using application name = $app." echo "Using application name = $app."
for i in {1..10} for i in {1..10}
do do
kubectl delete po demo-$app-$i-wo-discovery kubectl delete po demo-$app-$i-wo-discovery
done done
for i in {1..10} for i in {1..10}
do do
kubectl delete po demo-$app-$i-with-discovery kubectl delete po demo-$app-$i-with-discovery
done done

View file

@ -1,30 +1,14 @@
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: demo-cloverleaf-NUM name: demo-cloverleaf-NUM
annotations:
scheduler.alpha.kubernetes.io/affinity: |
{
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "feature.node.kubernetes.io/cpu-pstate.turbo",
"operator": "DoesNotExist"
}
]
}
]
}
}
}
spec: spec:
containers: containers:
- name: demo-container-cloverleaf-NUM - name: demo-container-cloverleaf-NUM
image: quay.io/kubernetes_incubator/node-feature-discovery-APP image: quay.io/kubernetes_incubator/node-feature-discovery-APP
ports: ports:
- containerPort: 3551 - containerPort: 3551
hostPort: 10001 hostPort: 10001
restartPolicy: Never nodeSelector:
feature.node.kubernetes.io/cpu-pstate.turbo: 'false'
restartPolicy: Never

View file

@ -5,8 +5,8 @@ metadata:
spec: spec:
containers: containers:
- image: quay.io/kubernetes_incubator/node-feature-discovery-IMG - image: quay.io/kubernetes_incubator/node-feature-discovery-IMG
name: demo-container-APP-NUM name: demo-container-APP-NUM
ports: ports:
- containerPort: 3351 - containerPort: 3351
hostPort: 10001 hostPort: 10001
restartPolicy: Never restartPolicy: Never

View file

@ -1,7 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
show_help() {
set -eo pipefail
this=`basename $0`
this_dir=`dirname $0`
show_help() {
cat << EOF cat << EOF
Usage: ${0##*/} [-a APPLICATION_NAME] Usage: $this [-a APPLICATION_NAME]
Runs pods ten times with discovery enabled. Runs pods ten times with discovery enabled.
-a APPLICATION_NAME run the pods with APPLICATION_NAME application. -a APPLICATION_NAME run the pods with APPLICATION_NAME application.
@ -21,7 +27,7 @@ OPTIND=1
options="ha:" options="ha:"
while getopts $options option while getopts $options option
do do
case $option in case $option in
a) a)
if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ] if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ]
then then
@ -32,11 +38,11 @@ do
exit 0 exit 0
fi fi
;; ;;
h) h)
show_help show_help
exit 0 exit 0
;; ;;
'?') '?')
show_help show_help
exit 1 exit 1
;; ;;
@ -49,14 +55,12 @@ for i in {1..10}
do do
if [ "$app" == "parsec" ] if [ "$app" == "parsec" ]
then then
sed -e "s/NUM/$i-with-discovery/" -e "s/APP/demo-1/" demo-pod-with-discovery.yaml.parsec.template > demo-pod-with-discovery.yaml sed -e "s/NUM/$i-with-discovery/" -e "s/APP/demo-1/" \
kubectl create -f demo-pod-with-discovery.yaml "$this_dir/demo-pod-with-discovery.yaml.parsec.template" | kubectl create -f -
else else
sed -e "s/NUM/$i-with-discovery/" -e "s/APP/demo-2/" demo-pod-with-discovery.yaml.cloverleaf.template > demo-pod-with-discovery.yaml sed -e "s/NUM/$i-with-discovery/" -e "s/APP/demo-2/" \
kubectl create -f demo-pod-with-discovery.yaml "$this_dir/demo-pod-with-discovery.yaml.cloverleaf.template" | kubectl create -f -
fi fi
echo "WithDiscovery" >> labels-with-discovery-$app.log echo "WithDiscovery" >> labels-with-discovery-$app.log
done done
echo "Ten pods with node feature discovery enabled started." echo "Ten pods with node feature discovery enabled started."
rm -f demo-pod-with-discovery.yaml

View file

@ -1,7 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
show_help() {
set -eo pipefail
this=`basename $0`
this_dir=`dirname $0`
show_help() {
cat << EOF cat << EOF
Usage: ${0##*/} [-a APPLICATION_NAME] Usage: $this [-a APPLICATION_NAME]
Runs ten pods without discovery enabled with the specified application. Runs ten pods without discovery enabled with the specified application.
-a APPLICATION_NAME run the pods with APPLICATION_NAME application. -a APPLICATION_NAME run the pods with APPLICATION_NAME application.
@ -21,7 +27,7 @@ OPTIND=1
options="ha:" options="ha:"
while getopts $options option while getopts $options option
do do
case $option in case $option in
a) a)
if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ] if [ "$OPTARG" == "parsec" ] || [ "$OPTARG" == "cloverleaf" ]
then then
@ -32,11 +38,11 @@ do
exit 0 exit 0
fi fi
;; ;;
h) h)
show_help show_help
exit 0 exit 0
;; ;;
'?') '?')
show_help show_help
exit 1 exit 1
;; ;;
@ -49,13 +55,12 @@ for i in {1..10}
do do
if [ "$app" == "parsec" ] if [ "$app" == "parsec" ]
then then
sed -e "s/NUM/$i-wo-discovery/" -e "s/IMG/demo-1/" -e "s/APP/$app/" demo-pod-without-discovery.yaml.template > demo-pod-without-discovery.yaml sed -e "s/NUM/$i-wo-discovery/" -e "s/IMG/demo-1/" -e "s/APP/$app/" \
"$this_dir/demo-pod-without-discovery.yaml.template" | kubectl create -f -
else else
sed -e "s/NUM/$i-wo-discovery/" -e "s/IMG/demo-2/" -e "s/APP/$app/" demo-pod-without-discovery.yaml.template > demo-pod-without-discovery.yaml sed -e "s/NUM/$i-wo-discovery/" -e "s/IMG/demo-2/" -e "s/APP/$app/" \
"$this_dir/demo-pod-without-discovery.yaml.template" | kubectl create -f -
fi fi
kubectl create -f demo-pod-without-discovery.yaml
echo "WithoutDiscovery" >> labels-without-discovery-$app.log echo "WithoutDiscovery" >> labels-without-discovery-$app.log
done done
echo "Ten pods without node feature discovery started." echo "Ten pods without node feature discovery started."
rm -f demo-pod-without-discovery.yaml