Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c4efc62d
Commit
c4efc62d
authored
May 22, 2015
by
jayunit100
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
K8petstore shell update, separated from the larger PR
Also, cleaned up whitespace inconsistencies.
parent
3e06df42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
43 deletions
+76
-43
k8petstore.sh
examples/k8petstore/k8petstore.sh
+76
-43
No files found.
examples/k8petstore/k8petstore.sh
View file @
c4efc62d
...
@@ -16,16 +16,32 @@
...
@@ -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
...
@@ -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
}
### Print statistics of db size, every second, until $SECONDS are up.
function
tests
{
for
i
in
`
seq
1
$SECONDS
`
;
pass_load
=
0
do
echo
"curl :
$i
"
### Print statistics of db size, every second, until $SECONDS are up.
curl
"
$PUBLIC_IP
:3000/llen"
>>
result
for
i
in
`
seq
1
$_SECONDS
`
;
sleep
1
do
done
echo
"curl :
$PUBLIC_IP
:3000 ,
$i
of
$_SECONDS
"
curr_cnt
=
"
`
curl
"
$PUBLIC_IP
:3000/llen"
`
"
### Write CSV File of # of trials / total transcations.
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment