Fix route regexp for gce-kube-down

pull/6/head
Jeff Lowdermilk 2015-06-02 10:54:35 -07:00
parent 00005f4da8
commit e02483e3fe
1 changed files with 7 additions and 3 deletions

View File

@ -816,10 +816,14 @@ function kube-down {
# Delete routes. # Delete routes.
local -a routes local -a routes
# Clean up all routes w/ names like "<cluster-name>-minion-<4-char-node-identifier>" # Clean up all routes w/ names like "<cluster-name>-<node-GUID>"
# e.g. "kubernetes-minion-2pl1" # e.g. "kubernetes-12345678-90ab-cdef-1234-567890abcdef". The name is
# determined by the node controller on the master.
# Note that this is currently a noop, as synchronously deleting the node MIG
# first allows the master to cleanup routes itself.
local TRUNCATED_PREFIX="${INSTANCE_PREFIX:0:26}"
routes=( $(gcloud compute routes list --project "${PROJECT}" \ routes=( $(gcloud compute routes list --project "${PROJECT}" \
--regexp "${INSTANCE_PREFIX}-minion-.{4}" | awk 'NR >= 2 { print $1 }') ) --regexp "${TRUNCATED_PREFIX}-.{8}-.{4}-.{4}-.{4}-.{12}" | awk 'NR >= 2 { print $1 }') )
while (( "${#routes[@]}" > 0 )); do while (( "${#routes[@]}" > 0 )); do
echo Deleting routes "${routes[*]::10}" echo Deleting routes "${routes[*]::10}"
gcloud compute routes delete \ gcloud compute routes delete \