From 70ac7abb109e0fc3168e9e3ec381abb901387c95 Mon Sep 17 00:00:00 2001 From: Jing Dong Date: Mon, 13 Jun 2016 15:02:14 +0100 Subject: [PATCH] kube-up.sh should allow using existing DHCP option set without making changes to existing VPC configuration. --- cluster/aws/util.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cluster/aws/util.sh b/cluster/aws/util.sh index 80170c5f274..440bfce7721 100755 --- a/cluster/aws/util.sh +++ b/cluster/aws/util.sh @@ -612,22 +612,24 @@ function ensure-master-ip { fi } -# Creates a new DHCP option set configured correctly for Kubernetes +# Creates a new DHCP option set configured correctly for Kubernetes when DHCP_OPTION_SET_ID is not specified # Sets DHCP_OPTION_SET_ID function create-dhcp-option-set () { - case "${AWS_REGION}" in - us-east-1) - OPTION_SET_DOMAIN=ec2.internal - ;; + if [[ -z ${DHCP_OPTION_SET_ID-} ]]; then + case "${AWS_REGION}" in + us-east-1) + OPTION_SET_DOMAIN=ec2.internal + ;; - *) - OPTION_SET_DOMAIN="${AWS_REGION}.compute.internal" - esac + *) + OPTION_SET_DOMAIN="${AWS_REGION}.compute.internal" + esac - DHCP_OPTION_SET_ID=$($AWS_CMD create-dhcp-options --dhcp-configuration Key=domain-name,Values=${OPTION_SET_DOMAIN} Key=domain-name-servers,Values=AmazonProvidedDNS --query DhcpOptions.DhcpOptionsId) + DHCP_OPTION_SET_ID=$($AWS_CMD create-dhcp-options --dhcp-configuration Key=domain-name,Values=${OPTION_SET_DOMAIN} Key=domain-name-servers,Values=AmazonProvidedDNS --query DhcpOptions.DhcpOptionsId) - add-tag ${DHCP_OPTION_SET_ID} Name kubernetes-dhcp-option-set - add-tag ${DHCP_OPTION_SET_ID} KubernetesCluster ${CLUSTER_ID} + add-tag ${DHCP_OPTION_SET_ID} Name kubernetes-dhcp-option-set + add-tag ${DHCP_OPTION_SET_ID} KubernetesCluster ${CLUSTER_ID} + fi $AWS_CMD associate-dhcp-options --dhcp-options-id ${DHCP_OPTION_SET_ID} --vpc-id ${VPC_ID} > $LOG