From 2429c7edf8588b6f0d8faa57f1f1b2d91eed7bde Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Mon, 6 Jul 2015 10:10:34 -0400 Subject: [PATCH] AWS: Allow callers to specify VPC_ID and SUBNET_ID This is for people that want to run in a shared VPC/Subnet; while this should work, we don't actively want to support it yet. So we don't block it, but we don't document/encourage it either! --- cluster/aws/util.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index a6572d2f5bd..997cce80294 100644 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -678,8 +678,9 @@ function kube-up { import-public-key ${AWS_SSH_KEY_NAME} ${AWS_SSH_KEY}.pub - VPC_ID=$(get_vpc_id) - + if [[ -z "${VPC_ID:-}" ]]; then + VPC_ID=$(get_vpc_id) + fi if [[ -z "$VPC_ID" ]]; then echo "Creating vpc." VPC_ID=$($AWS_CMD create-vpc --cidr-block $INTERNAL_IP_BASE.0/16 | json_val '["Vpc"]["VpcId"]') @@ -691,7 +692,9 @@ function kube-up { echo "Using VPC $VPC_ID" - SUBNET_ID=$($AWS_CMD describe-subnets --filters Name=tag:KubernetesCluster,Values=${CLUSTER_ID} | get_subnet_id $VPC_ID $ZONE) + if [[ -z "${SUBNET_ID:-}" ]]; then + SUBNET_ID=$($AWS_CMD describe-subnets --filters Name=tag:KubernetesCluster,Values=${CLUSTER_ID} | get_subnet_id $VPC_ID $ZONE) + fi if [[ -z "$SUBNET_ID" ]]; then echo "Creating subnet." SUBNET_ID=$($AWS_CMD create-subnet --cidr-block $INTERNAL_IP_BASE.0/24 --vpc-id $VPC_ID --availability-zone ${ZONE} | json_val '["Subnet"]["SubnetId"]')