mirror of https://github.com/k3s-io/k3s
Merge pull request #8255 from iterion/default_dhcp_option_set
AWS: Create DHCP Option Set on kube-uppull/6/head
commit
1efee0b49e
|
@ -417,6 +417,28 @@ function ensure-master-pd {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Creates a new DHCP option set configured correctly for Kubernetes
|
||||||
|
# Sets DHCP_OPTION_SET_ID
|
||||||
|
function create-dhcp-option-set () {
|
||||||
|
case "${AWS_REGION}" in
|
||||||
|
us-east-1)
|
||||||
|
OPTION_SET_DOMAIN=ec2.internal
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
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 | json_val '["DhcpOptions"]["DhcpOptionsId"]')
|
||||||
|
|
||||||
|
add-tag ${DHCP_OPTION_SET_ID} Name kubernetes-dhcp-option-set
|
||||||
|
add-tag ${DHCP_OPTION_SET_ID} KubernetesCluster ${CLUSTER_ID}
|
||||||
|
|
||||||
|
$AWS_CMD associate-dhcp-options --dhcp-options-id ${DHCP_OPTION_SET_ID} --vpc-id ${VPC_ID}
|
||||||
|
|
||||||
|
echo "Using DHCP option set ${DHCP_OPTION_SET_ID}"
|
||||||
|
}
|
||||||
|
|
||||||
# Verify prereqs
|
# Verify prereqs
|
||||||
function verify-prereqs {
|
function verify-prereqs {
|
||||||
if [[ "$(which aws)" == "" ]]; then
|
if [[ "$(which aws)" == "" ]]; then
|
||||||
|
@ -694,9 +716,12 @@ function kube-up {
|
||||||
|
|
||||||
echo "Using VPC $VPC_ID"
|
echo "Using VPC $VPC_ID"
|
||||||
|
|
||||||
|
create-dhcp-option-set
|
||||||
|
|
||||||
if [[ -z "${SUBNET_ID:-}" ]]; then
|
if [[ -z "${SUBNET_ID:-}" ]]; then
|
||||||
SUBNET_ID=$($AWS_CMD describe-subnets --filters Name=tag:KubernetesCluster,Values=${CLUSTER_ID} | get_subnet_id $VPC_ID $ZONE)
|
SUBNET_ID=$($AWS_CMD describe-subnets --filters Name=tag:KubernetesCluster,Values=${CLUSTER_ID} | get_subnet_id $VPC_ID $ZONE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$SUBNET_ID" ]]; then
|
if [[ -z "$SUBNET_ID" ]]; then
|
||||||
echo "Creating subnet."
|
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"]')
|
SUBNET_ID=$($AWS_CMD create-subnet --cidr-block $INTERNAL_IP_BASE.0/24 --vpc-id $VPC_ID --availability-zone ${ZONE} | json_val '["Subnet"]["SubnetId"]')
|
||||||
|
|
Loading…
Reference in New Issue