mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #13031 from daizuozhuo/kubectl-get
Auto commit by PR queue bot
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user