mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Merge pull request #25159 from ixdy/gcloud-fields-flag
Use --format='value()' instead of --fields with gcloud compute instances describe
This commit is contained in:
		@@ -313,8 +313,7 @@ function detect-nodes () {
 | 
			
		||||
  KUBE_NODE_IP_ADDRESSES=()
 | 
			
		||||
  for (( i=0; i<${#NODE_NAMES[@]}; i++)); do
 | 
			
		||||
    local node_ip=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
 | 
			
		||||
      "${NODE_NAMES[$i]}" --fields networkInterfaces[0].accessConfigs[0].natIP \
 | 
			
		||||
      --format=text | awk '{ print $2 }')
 | 
			
		||||
      "${NODE_NAMES[$i]}" --format='value(networkInterfaces[0].accessConfigs[0].natIP)')
 | 
			
		||||
    if [[ -z "${node_ip-}" ]] ; then
 | 
			
		||||
      echo "Did not find ${NODE_NAMES[$i]}" >&2
 | 
			
		||||
    else
 | 
			
		||||
@@ -341,8 +340,7 @@ function detect-master () {
 | 
			
		||||
  KUBE_MASTER=${MASTER_NAME}
 | 
			
		||||
  if [[ -z "${KUBE_MASTER_IP-}" ]]; then
 | 
			
		||||
    KUBE_MASTER_IP=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
 | 
			
		||||
      "${MASTER_NAME}" --fields networkInterfaces[0].accessConfigs[0].natIP \
 | 
			
		||||
      --format=text | awk '{ print $2 }')
 | 
			
		||||
      "${MASTER_NAME}" --format='value(networkInterfaces[0].accessConfigs[0].natIP)')
 | 
			
		||||
  fi
 | 
			
		||||
  if [[ -z "${KUBE_MASTER_IP-}" ]]; then
 | 
			
		||||
    echo "Could not detect Kubernetes master node.  Make sure you've launched a cluster with 'kube-up.sh'" >&2
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user