mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Fix ip-alias testing.
IP aliases are an alpha feature, and node accelerators are a beta feature. $gcloud determines which is appropriate. Before, this would try to run "gcloud alpha beta", which is incoherent.
This commit is contained in:
		@@ -505,6 +505,15 @@ function create-node-template() {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local gcloud="gcloud"
 | 
					  local gcloud="gcloud"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  local accelerator_args=""
 | 
				
			||||||
 | 
					  # VMs with Accelerators cannot be live migrated.
 | 
				
			||||||
 | 
					  # More details here - https://cloud.google.com/compute/docs/gpus/add-gpus#create-new-gpu-instance
 | 
				
			||||||
 | 
					  if [[ ! -z "${NODE_ACCELERATORS}" ]]; then
 | 
				
			||||||
 | 
					    accelerator_args="--maintenance-policy TERMINATE --restart-on-failure --accelerator ${NODE_ACCELERATORS}"
 | 
				
			||||||
 | 
					    gcloud="gcloud beta"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
 | 
					  if [[ "${ENABLE_IP_ALIASES:-}" == 'true' ]]; then
 | 
				
			||||||
    gcloud="gcloud alpha"
 | 
					    gcloud="gcloud alpha"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
@@ -527,16 +536,10 @@ function create-node-template() {
 | 
				
			|||||||
    "${IP_ALIAS_SUBNETWORK:-}" \
 | 
					    "${IP_ALIAS_SUBNETWORK:-}" \
 | 
				
			||||||
    "${IP_ALIAS_SIZE:-}")
 | 
					    "${IP_ALIAS_SIZE:-}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local accelerator_args=""
 | 
					 | 
				
			||||||
  # VMs with Accelerators cannot be live migrated.
 | 
					 | 
				
			||||||
  # More details here - https://cloud.google.com/compute/docs/gpus/add-gpus#create-new-gpu-instance
 | 
					 | 
				
			||||||
  if [[ ! -z "${NODE_ACCELERATORS}" ]]; then
 | 
					 | 
				
			||||||
      accelerator_args="--maintenance-policy TERMINATE --restart-on-failure --accelerator ${NODE_ACCELERATORS}"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  local attempt=1
 | 
					  local attempt=1
 | 
				
			||||||
  while true; do
 | 
					  while true; do
 | 
				
			||||||
    echo "Attempt ${attempt} to create ${1}" >&2
 | 
					    echo "Attempt ${attempt} to create ${1}" >&2
 | 
				
			||||||
    if ! ${gcloud} beta compute instance-templates create \
 | 
					    if ! ${gcloud} compute instance-templates create \
 | 
				
			||||||
      "$template_name" \
 | 
					      "$template_name" \
 | 
				
			||||||
      --project "${PROJECT}" \
 | 
					      --project "${PROJECT}" \
 | 
				
			||||||
      --machine-type "${NODE_SIZE}" \
 | 
					      --machine-type "${NODE_SIZE}" \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user