-
Notifications
You must be signed in to change notification settings - Fork 1
/
time_pod_create.sh
31 lines (28 loc) · 949 Bytes
/
time_pod_create.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
programname=$0
usage() { printf "Usage: $0 [-y <pod yaml name>] [-u whether to roll Ratify before each create]" 1>&2; exit 1; }
uninstall=false
while getopts ":i:y:r:n:u" o; do
case "${o}" in
y) yaml_name=${OPTARG} ;;
u) uninstall=true ;;
*) usage ;;
esac
done
shift "$((OPTIND-1))"
if [ -z "${yaml_name}" ] || [ -z "${uninstall}" ]; then
usage
fi
for i in {1..100}; do
if [ "${uninstall}" = true ];
then
helm uninstall ratify -n ratify-service
helm install ratify ../ratify/charts/ratify --atomic --namespace ratify-service --create-namespace --set image.repository=anlandu/ratify --set image.tag=nosleep
fi
export KUBECTLPERFINDEX="1image$i"
yq -i '.metadata.name = strenv(KUBECTLPERFINDEX)' ./pods/${yaml_name}.yaml
start=$(($(date +%s%N)/1000000))
kubectl apply -f ./pods/${yaml_name}.yaml
echo $(($(date +%s%N)/1000000 - $start))
kubectl delete -f ./pods/${yaml_name}.yaml
done