Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
932cdd95
Commit
932cdd95
authored
May 12, 2015
by
saadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up GCE kube-down script by using set e
parent
c5b15087
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
util.sh
cluster/gce/util.sh
+13
-9
No files found.
cluster/gce/util.sh
View file @
932cdd95
...
...
@@ -643,11 +643,14 @@ function kube-down {
detect-project
echo
"Bringing down cluster"
set
+e
# Do not stop on error
# The gcloud APIs don't return machine parsable error codes/retry information. Therefore the best we can
# do is parse the output and special case particular responses we are interested in.
deleteCmdOutput
=
$(
gcloud preview managed-instance-groups
--zone
"
${
ZONE
}
"
delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
NODE_INSTANCE_PREFIX
}
-group"
||
true
)
"
${
NODE_INSTANCE_PREFIX
}
-group"
)
if
[[
"
$deleteCmdOutput
"
!=
""
]]
;
then
# Managed instance group deletion is done asyncronously, we must wait for it to complete, or subsequent steps fail
deleteCmdOperationId
=
$(
echo
$deleteCmdOutput
|
grep
"Operation:"
|
sed
"s/.*Operation:
\s
//"
|
sed
"s/
\s
.*//"
|
sed
"s/ //g"
)
...
...
@@ -666,7 +669,7 @@ function kube-down {
gcloud compute instance-templates delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
NODE_INSTANCE_PREFIX
}
-template"
||
true
"
${
NODE_INSTANCE_PREFIX
}
-template"
# First delete the master (if it exists).
gcloud compute instances delete
\
...
...
@@ -674,14 +677,14 @@ function kube-down {
--quiet
\
--delete-disks
all
\
--zone
"
${
ZONE
}
"
\
"
${
MASTER_NAME
}
"
||
true
"
${
MASTER_NAME
}
"
# Delete the master pd (possibly leaked by kube-up if master create failed)
gcloud compute disks delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
--zone
"
${
ZONE
}
"
\
"
${
MASTER_NAME
}
"
-pd
||
true
"
${
MASTER_NAME
}
"
-pd
# Find out what minions are running.
local
-a
minions
...
...
@@ -697,7 +700,7 @@ function kube-down {
--quiet
\
--delete-disks
boot
\
--zone
"
${
ZONE
}
"
\
"
${
minions
[@]
::10
}
"
||
true
"
${
minions
[@]
::10
}
"
minions
=(
"
${
minions
[@]
:10
}
"
)
done
...
...
@@ -705,13 +708,13 @@ function kube-down {
gcloud compute firewall-rules delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
MASTER_NAME
}
-https"
||
true
"
${
MASTER_NAME
}
-https"
# Delete firewall rule for minions.
gcloud compute firewall-rules delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
MINION_TAG
}
-all"
||
true
"
${
MINION_TAG
}
-all"
# Delete routes.
local
-a
routes
...
...
@@ -723,7 +726,7 @@ function kube-down {
gcloud compute routes delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
routes
[@]
::10
}
"
||
true
"
${
routes
[@]
::10
}
"
routes
=(
"
${
routes
[@]
:10
}
"
)
done
...
...
@@ -733,10 +736,11 @@ function kube-down {
--project
"
${
PROJECT
}
"
\
--region
"
${
REGION
}
"
\
--quiet
\
"
${
MASTER_NAME
}
-ip"
||
true
"
${
MASTER_NAME
}
-ip"
export
CONTEXT
=
"
${
PROJECT
}
_
${
INSTANCE_PREFIX
}
"
clear-kubeconfig
set
-e
}
# Update a kubernetes cluster with latest source
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment