Merge pull request #32873 from jszczepkowski/ha-delete-nodes2

Automatic merge from submit-queue

Implemented KUBE_DELETE_NODES flag in kube-down.

Implemented KUBE_DELETE_NODES flag in kube-down script.
It prevents removal of nodes when shutting down a HA master replica.
This commit is contained in:
Kubernetes Submit Queue 2016-09-19 01:08:18 -07:00 committed by GitHub
commit 87c2650038
3 changed files with 48 additions and 42 deletions

View File

@ -34,6 +34,7 @@ NODE_DISK_SIZE=${NODE_DISK_SIZE:-100GB}
REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true} REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true}
PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false} PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false} PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}
KUBE_DELETE_NODES=${KUBE_DELETE_NODES:-true}
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-debian}} NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-debian}}

View File

@ -35,6 +35,7 @@ REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-true}
KUBE_APISERVER_REQUEST_TIMEOUT=300 KUBE_APISERVER_REQUEST_TIMEOUT=300
PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false} PREEMPTIBLE_NODE=${PREEMPTIBLE_NODE:-false}
PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false} PREEMPTIBLE_MASTER=${PREEMPTIBLE_MASTER:-false}
KUBE_DELETE_NODES=${KUBE_DELETE_NODES:-true}
MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}} MASTER_OS_DISTRIBUTION=${KUBE_MASTER_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-gci}}
NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-debian}} NODE_OS_DISTRIBUTION=${KUBE_NODE_OS_DISTRIBUTION:-${KUBE_OS_DISTRIBUTION:-debian}}

View File

@ -1132,6 +1132,7 @@ function kube-down() {
echo "Bringing down cluster" echo "Bringing down cluster"
set +e # Do not stop on error set +e # Do not stop on error
if [[ "${KUBE_DELETE_NODES:-}" != "false" ]]; then
# Get the name of the managed instance group template before we delete the # Get the name of the managed instance group template before we delete the
# managed instance group. (The name of the managed instance group template may # managed instance group. (The name of the managed instance group template may
# change during a cluster upgrade.) # change during a cluster upgrade.)
@ -1160,6 +1161,7 @@ function kube-down() {
"${template}" "${template}"
fi fi
done done
fi
local -r REPLICA_NAME="$(get-replica-name)" local -r REPLICA_NAME="$(get-replica-name)"
@ -1261,6 +1263,7 @@ function kube-down() {
fi fi
fi fi
if [[ "${KUBE_DELETE_NODES:-}" != "false" ]]; then
# Find out what minions are running. # Find out what minions are running.
local -a minions local -a minions
minions=( $(gcloud compute instances list \ minions=( $(gcloud compute instances list \
@ -1278,6 +1281,7 @@ function kube-down() {
"${minions[@]::${batch}}" "${minions[@]::${batch}}"
minions=( "${minions[@]:${batch}}" ) minions=( "${minions[@]:${batch}}" )
done done
fi
# Delete routes. # Delete routes.
local -a routes local -a routes