change -o template to -o go-template=...

This commit is contained in:
Dai Zuozhuo
2015-08-21 21:09:41 +08:00
parent 9ccceac5e8
commit 2e2ef3e830
30 changed files with 124 additions and 74 deletions

View File

@@ -232,10 +232,10 @@ $kubectl create -f bps-load-gen-rc.json --namespace=$NS
#Get the IP addresses of all Kubernetes nodes.
function getIP {
#currently this script is only tested on GCE. The following line may need to be updated if k8s is not running on a cloud platform
NODES_IP=$($kubectl get nodes -t='{{range .items}}{{range .status.addresses}}{{if or (eq .type "ExternalIP") (eq .type "LegacyHostIP")}}{{.address}}{{print "\n"}}{{end}}{{end}}{{end}}')
TEST_IP=$($kubectl get nodes -t='{{range (index .items 0).status.addresses}}{{if eq .type "ExternalIP"}}{{.address}}{{end}}{{end}}')
NODES_IP=$($kubectl get nodes -o go-template='{{range .items}}{{range .status.addresses}}{{if or (eq .type "ExternalIP") (eq .type "LegacyHostIP")}}{{.address}}{{print "\n"}}{{end}}{{end}}{{end}}')
TEST_IP=$($kubectl get nodes -o go-template='{{range (index .items 0).status.addresses}}{{if eq .type "ExternalIP"}}{{.address}}{{end}}{{end}}')
if [ -z "$TEST_IP" ]; then
TEST_IP=$($kubectl get nodes -t='{{range (index .items 0).status.addresses}}{{if eq .type "LegacyHostIP"}}{{.address}}{{end}}{{end}}')
TEST_IP=$($kubectl get nodes -o go-template='{{range (index .items 0).status.addresses}}{{if eq .type "LegacyHostIP"}}{{.address}}{{end}}{{end}}')
fi
if [ -z "$NODES_IP" ]; then
echo "Error: Can't get node's IP!!!"
@@ -249,7 +249,7 @@ function getIP {
}
function getNodePort {
NODE_PORT=$($kubectl get services/frontend -t='{{(index .spec.ports 0).nodePort}}')
NODE_PORT=$($kubectl get services/frontend -o go-template='{{(index .spec.ports 0).nodePort}}')
if [ -z "$NODE_PORT" ]; then
echo "Error: Can't get NodePort of services/frontend!!!"
exit 1