K8petstore shell update, separated from the larger PR
Also, cleaned up whitespace inconsistencies.
This commit is contained in:
parent
fc493ba855
commit
b9a4ea6aba
|
@ -16,16 +16,32 @@
|
||||||
|
|
||||||
echo "WRITING KUBE FILES , will overwrite the jsons, then testing pods. is kube clean ready to go?"
|
echo "WRITING KUBE FILES , will overwrite the jsons, then testing pods. is kube clean ready to go?"
|
||||||
|
|
||||||
|
|
||||||
|
#Args below can be overriden when calling from cmd line.
|
||||||
|
#Just send all the args in order.
|
||||||
#for dev/test you can use:
|
#for dev/test you can use:
|
||||||
#kubectl=$GOPATH/src/github.com/GoogleCloudPlatform/kubernetes/cluster/kubectl.sh"
|
#kubectl=$GOPATH/src/github.com/GoogleCloudPlatform/kubernetes/cluster/kubectl.sh"
|
||||||
kubectl="kubectl"
|
kubectl="kubectl"
|
||||||
VERSION="r.2.8.19"
|
VERSION="r.2.8.19"
|
||||||
PUBLIC_IP="10.1.4.89" # ip which we use to access the Web server.
|
PUBLIC_IP="10.1.4.89" # ip which we use to access the Web server.
|
||||||
SECONDS=1000 # number of seconds to measure throughput.
|
_SECONDS=1000 # number of seconds to measure throughput.
|
||||||
FE="1" # amount of Web server
|
FE="1" # amount of Web server
|
||||||
LG="1" # amount of load generators
|
LG="1" # amount of load generators
|
||||||
SLAVE="1" # amount of redis slaves
|
SLAVE="1" # amount of redis slaves
|
||||||
|
TEST="1" # 0 = Dont run tests, 1 = Do run tests.
|
||||||
|
NS="k8petstore" # namespace
|
||||||
|
|
||||||
|
kubectl="${1:-$kubectl}"
|
||||||
|
VERSION="${2:-$VERSION}"
|
||||||
|
PUBLIC_IP="${3:-$PUBLIC_IP}" # ip which we use to access the Web server.
|
||||||
|
_SECONDS="${4:-$_SECONDS}" # number of seconds to measure throughput.
|
||||||
|
FE="${5:-$FE}" # amount of Web server
|
||||||
|
LG="${6:-$LG}" # amount of load generators
|
||||||
|
SLAVE="${7:-$SLAVE}" # amount of redis slaves
|
||||||
|
TEST="${8:-$TEST}" # 0 = Dont run tests, 1 = Do run tests.
|
||||||
|
NS="${9:-$NS}" # namespace
|
||||||
|
|
||||||
|
echo "Running w/ args: kubectl $kubectl version $VERSION ip $PUBLIC_IP sec $_SECONDS fe $FE lg $LG slave $SLAVE test $TEST NAMESPACE $NS"
|
||||||
function create {
|
function create {
|
||||||
|
|
||||||
cat << EOF > fe-rc.json
|
cat << EOF > fe-rc.json
|
||||||
|
@ -188,53 +204,70 @@ cat << EOF > slave-rc.json
|
||||||
"labels": {"name": "redisslave"}
|
"labels": {"name": "redisslave"}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
$kubectl create -f rm.json --api-version=v1beta1
|
$kubectl create -f rm.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f rm-s.json --api-version=v1beta1
|
$kubectl create -f rm-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
sleep 3 # precaution to prevent fe from spinning up too soon.
|
sleep 3 # precaution to prevent fe from spinning up too soon.
|
||||||
$kubectl create -f slave-rc.json --api-version=v1beta1
|
$kubectl create -f slave-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f rs-s.json --api-version=v1beta1
|
$kubectl create -f rs-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
sleep 3 # see above comment.
|
sleep 3 # see above comment.
|
||||||
$kubectl create -f fe-rc.json --api-version=v1beta1
|
$kubectl create -f fe-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f fe-s.json --api-version=v1beta1
|
$kubectl create -f fe-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f bps-load-gen-rc.json --api-version=v1beta1
|
$kubectl create -f bps-load-gen-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
}
|
}
|
||||||
|
|
||||||
function test {
|
function pollfor {
|
||||||
pass_http=0
|
pass_http=0
|
||||||
|
|
||||||
### Test HTTP Server comes up.
|
### Test HTTP Server comes up.
|
||||||
for i in `seq 1 150`;
|
for i in `seq 1 150`;
|
||||||
do
|
do
|
||||||
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
||||||
echo "Trying curl ... $i . expect a few failures while pulling images... "
|
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
||||||
curl "$PUBLIC_IP:3000" > result
|
curl "$PUBLIC_IP:3000" > result
|
||||||
cat result
|
cat result
|
||||||
cat result | grep -q "k8-bps"
|
cat result | grep -q "k8-bps"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "TEST PASSED after $i tries !"
|
echo "TEST PASSED after $i tries !"
|
||||||
i=1000
|
i=1000
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "the above RESULT didn't contain target string for trial $i"
|
echo "the above RESULT didn't contain target string for trial $i"
|
||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $i -eq 1000 ]; then
|
if [ $i -eq 1000 ]; then
|
||||||
pass_http=-1
|
pass_http=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
pass_load=0
|
function tests {
|
||||||
|
pass_load=0
|
||||||
|
|
||||||
### Print statistics of db size, every second, until $SECONDS are up.
|
### Print statistics of db size, every second, until $SECONDS are up.
|
||||||
for i in `seq 1 $SECONDS`;
|
for i in `seq 1 $_SECONDS`;
|
||||||
do
|
do
|
||||||
echo "curl : $i"
|
echo "curl : $PUBLIC_IP:3000 , $i of $_SECONDS"
|
||||||
curl "$PUBLIC_IP:3000/llen" >> result
|
curr_cnt="`curl "$PUBLIC_IP:3000/llen"`"
|
||||||
sleep 1
|
### Write CSV File of # of trials / total transcations.
|
||||||
done
|
echo "$i $curr_cnt" >> result
|
||||||
|
echo "total transactions so far : $curr_cnt"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
create
|
create
|
||||||
|
|
||||||
test
|
pollfor
|
||||||
|
|
||||||
|
if [[ $pass_http -eq 1 ]]; then
|
||||||
|
echo "Passed..."
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $TEST -eq 1 ]]; then
|
||||||
|
echo "running polling tests now"
|
||||||
|
tests
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue