Merge pull request #81073 from mborsz/cnat

Few improvements to Cloud NAT
This commit is contained in:
Kubernetes Prow Robot 2019-10-23 05:08:14 -07:00 committed by GitHub
commit b084336460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -496,6 +496,7 @@ WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSche
# Whether to set up a private GCE cluster, i.e. a cluster where nodes have only private IPs.
GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}"
GCE_PRIVATE_CLUSTER_PORTS_PER_VM="${KUBE_GCE_PRIVATE_CLUSTER_PORTS_PER_VM:-}"
# Optional: Create apiserver konnectivity server and agent.
ENABLE_EGRESS_VIA_KONNECTIVITY_SERVICE="${KUBE_ENABLE_EGRESS_VIA_KONNECTIVITY_SERVICE:-false}"

View File

@ -537,6 +537,7 @@ WINDOWS_NODE_TAINTS="${WINDOWS_NODE_TAINTS:-node.kubernetes.io/os=win1809:NoSche
# Whether to set up a private GCE cluster, i.e. a cluster where nodes have only private IPs.
GCE_PRIVATE_CLUSTER="${KUBE_GCE_PRIVATE_CLUSTER:-false}"
GCE_PRIVATE_CLUSTER_PORTS_PER_VM="${KUBE_GCE_PRIVATE_CLUSTER_PORTS_PER_VM:-}"
ETCD_LISTEN_CLIENT_IP=0.0.0.0

View File

@ -2495,6 +2495,10 @@ function detect-subnetworks() {
# NETWORK
function create-cloud-nat-router() {
if [[ ${GCE_PRIVATE_CLUSTER:-} == "true" ]]; then
if gcloud compute routers describe "$NETWORK-nat-router" --project $NETWORK_PROJECT --region $REGION &>/dev/null; then
echo "Cloud nat already exists"
return 0
fi
gcloud compute routers create "$NETWORK-nat-router" \
--project $NETWORK_PROJECT \
--region $REGION \
@ -2503,8 +2507,9 @@ function create-cloud-nat-router() {
--project $NETWORK_PROJECT \
--router-region $REGION \
--router "$NETWORK-nat-router" \
--nat-all-subnet-ip-ranges \
--auto-allocate-nat-external-ips
--nat-primary-subnet-ip-ranges \
--auto-allocate-nat-external-ips \
${GCE_PRIVATE_CLUSTER_PORTS_PER_VM:+--min-ports-per-vm ${GCE_PRIVATE_CLUSTER_PORTS_PER_VM}}
fi
}
@ -3851,13 +3856,6 @@ function check-resources() {
return 1
fi
if [[ ${GCE_PRIVATE_CLUSTER:-} == "true" ]]; then
if gcloud compute routers describe --project "${NETWORK_PROJECT}" --region "${REGION}" "${NETWORK}-nat-router" &>/dev/null; then
KUBE_RESOURCE_FOUND="Cloud NAT router"
return 1
fi
fi
# No resources found.
return 0
}