Merge pull request #30777 from k82cn/use_k8petstore_ns

Automatic merge from submit-queue

Updated k8petstore example to use non-default namespace.

fixes #24314
pull/6/head
Kubernetes Submit Queue 2016-09-11 02:38:50 -07:00 committed by GitHub
commit 5541e18aaa
4 changed files with 85 additions and 4 deletions

View File

@ -132,7 +132,7 @@ Now that you are done hacking around on the app, you can run it in Kubernetes.
Now, how to run the entire application in Kubernetes?
To simplify running this application, we have a single file, k8petstore.sh, which writes out json files on to disk. This allows us to have dynamic parameters, without needing to worry about managing multiple json files.
To simplify running this application, we have a single file, [k8petstore.sh](k8petstore.sh), which writes out json files on to disk. This allows us to have dynamic parameters, e.g. the namespace is configured by `NS` whose default value is `k8petstore`, without needing to worry about managing multiple json files.
You might want to change it to point to your customized Go image, if you chose to modify things, like the number of data generators (more generators will create more load on the redis master).

View File

@ -28,7 +28,7 @@ FE="1" # amount of Web server
LG="1" # amount of load generators
SLAVE="1" # amount of redis slaves
TEST="1" # 0 = Don't run tests, 1 = Do run tests.
NS="default" # namespace
NS="k8petstore" # namespace
kubectl="${1:-$kubectl}"
VERSION="${2:-$VERSION}"
@ -40,6 +40,30 @@ TEST="${7:-$TEST}" # 0 = Don't run tests, 1 = Do run tests.
NS="${8:-$NS}" # namespace
echo "Running w/ args: kubectl $kubectl version $VERSION sec $_SECONDS fe $FE lg $LG slave $SLAVE test $TEST NAMESPACE $NS"
function create_ns {
case "$NS" in
"default" )
;;
"kube-system" )
;;
* )
cat << EOF > ns.json
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "$NS"
}
}
EOF
$kubectl create -f ns.json
esac
}
function create {
cat << EOF > fe-rc.json
@ -216,6 +240,9 @@ cat << EOF > slave-rc.json
}
}
EOF
create_ns
$kubectl create -f rm.json --namespace=$NS
$kubectl create -f rm-s.json --namespace=$NS
sleep 3 # precaution to prevent fe from spinning up too soon.

View File

@ -29,7 +29,7 @@ FE="1" # amount of Web server
LG="1" # amount of load generators
SLAVE="1" # amount of redis slaves
TEST="1" # 0 = Don't run tests, 1 = Do run tests.
NS="default" # namespace
NS="k8petstore" # namespace
NODE_PORT=30291 #nodePort, see fe-s.json
kubectl="${1:-$kubectl}"
@ -42,6 +42,30 @@ TEST="${7:-$TEST}" # 0 = Don't run tests, 1 = Do run tests.
NS="${8:-$NS}" # namespace
NODE_PORT="${9:-$NODE_PORT}" #nodePort, see fe-s.json
echo "Running w/ args: kubectl $kubectl version $VERSION sec $_SECONDS fe $FE lg $LG slave $SLAVE test = $TEST, NAMESPACE = $NS, NODE_PORT = $NODE_PORT"
function create_ns {
case "$NS" in
"default" )
;;
"kube-system" )
;;
* )
cat << EOF > ns.json
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "$NS"
}
}
EOF
$kubectl create -f ns.json
esac
}
function create {
cat << EOF > fe-rc.json
@ -219,6 +243,9 @@ cat << EOF > slave-rc.json
}
}
EOF
create_ns
$kubectl create -f rm.json --namespace=$NS
$kubectl create -f rm-s.json --namespace=$NS
sleep 3 # precaution to prevent fe from spinning up too soon.

View File

@ -29,7 +29,7 @@ FE="1" # amount of Web server
LG="1" # amount of load generators
SLAVE="1" # amount of redis slaves
TEST="1" # 0 = Don't run tests, 1 = Do run tests.
NS="default" # namespace
NS="k8petstore" # namespace
kubectl="${1:-$kubectl}"
VERSION="${2:-$VERSION}"
@ -42,6 +42,30 @@ TEST="${8:-$TEST}" # 0 = Don't 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_ns {
case "$NS" in
"default" )
;;
"kube-system" )
;;
* )
cat << EOF > ns.json
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "$NS"
}
}
EOF
$kubectl create -f ns.json
esac
}
function create {
cat << EOF > fe-rc.json
@ -218,6 +242,9 @@ cat << EOF > slave-rc.json
}
}
EOF
create_ns
$kubectl create -f rm.json --namespace=$NS
$kubectl create -f rm-s.json --namespace=$NS
sleep 3 # precaution to prevent fe from spinning up too soon.