Skip to content

Commit

Permalink
fix(scripts): deploy-ibm-vpc.sh public gateway detection. (kubeflow#622)
Browse files Browse the repository at this point in the history
A VPC may have more than one public gateways and they may be in
different cluster zones. So now filtering on cluster_zone and
picking the first public gateway.
  • Loading branch information
ScrapCodes authored Jun 16, 2021
1 parent 22354b3 commit 87dd3a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/deploy/iks/deploy-ibm-vpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ function existence_check() {

function vpc_name_to_gateway_id() {
existence_check "VPC_NAME" "vpc-name"
local value_pubgw_id=$(ibmcloud is pubgws -q | grep "\s${VPC_NAME}\s" | awk '{print $1}')
existence_check "CLUSTER_ZONE" "cluster-zone"
local value_pubgw_id=$(ibmcloud is pubgws -q | grep "\s${VPC_NAME}\s" | grep "\s${CLUSTER_ZONE}\s" | head -1 | awk '{print $1}')
echo $value_pubgw_id
}

Expand Down Expand Up @@ -348,8 +349,8 @@ else
GATEWAY_ID=$(ibmcloud is public-gateway-create -q "kf-${USER_STR}-${RAND_STR}-gw" "$VPC_ID" "$CLUSTER_ZONE" | grep "^ID\b\s" | awk '{print $2}')
echo "Created a public gateway: $GATEWAY_ID"
fi
echo "Attaching Gateway: $GATEWAY_ID to the subnet: $SUBNET_ID"
ibmcloud is subnet-update "$SUBNET_ID" --public-gateway-id "$GATEWAY_ID" 1>/dev/null
echo "Gateway: $GATEWAY_ID is attached to the subnet: $SUBNET_ID"
fi
fi
# A SUBNET is created recording the current env state.
Expand Down

0 comments on commit 87dd3a7

Please sign in to comment.