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
6d201c9c
Commit
6d201c9c
authored
Jun 22, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kube-down deletes instance templates created by the cluster upgrade
parent
1de2bdda
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
common.sh
cluster/common.sh
+2
-0
util.sh
cluster/gce/util.sh
+4
-2
No files found.
cluster/common.sh
View file @
6d201c9c
...
...
@@ -31,12 +31,14 @@ source "${KUBE_ROOT}/cluster/lib/logging.sh"
# NOTE This must match the version_regex in build/common.sh
# kube::release::parse_and_validate_release_version()
KUBE_RELEASE_VERSION_REGEX
=
"^v(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)(-(beta|alpha)
\\
.(0|[1-9][0-9]*))?$"
KUBE_RELEASE_VERSION_DASHED_REGEX
=
"v(0|[1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)(-(beta|alpha)-(0|[1-9][0-9]*))?"
# KUBE_CI_VERSION_REGEX matches things like "v1.2.3-alpha.4.56+abcdefg" This
#
# NOTE This must match the version_regex in build/common.sh
# kube::release::parse_and_validate_ci_version()
KUBE_CI_VERSION_REGEX
=
"^v(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)
\\
.(0|[1-9][0-9]*)-(beta|alpha)
\\
.(0|[1-9][0-9]*)(
\\
.(0|[1-9][0-9]*)
\\
+[-0-9a-z]*)?$"
KUBE_CI_VERSION_DASHED_REGEX
=
"^v(0|[1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)-(beta|alpha)-(0|[1-9][0-9]*)(-(0|[1-9][0-9]*)
\\
+[-0-9a-z]*)?"
# Generate kubeconfig data for the created cluster.
# Assumed vars:
...
...
cluster/gce/util.sh
View file @
6d201c9c
...
...
@@ -967,7 +967,7 @@ function kube-down {
# 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
# change during a cluster upgrade.)
local
template
=
$(
get-template
"
${
PROJECT
}
"
)
local
template
s
=
$(
get-template
"
${
PROJECT
}
"
)
for
group
in
${
INSTANCE_GROUPS
[@]
:-}
;
do
if
gcloud compute instance-groups managed describe
"
${
group
}
"
--project
"
${
PROJECT
}
"
--zone
"
${
ZONE
}
"
&>/dev/null
;
then
...
...
@@ -984,12 +984,14 @@ function kube-down {
echo
-e
"Failed to delete instance group(s)."
>
&2
}
for
template
in
${
templates
[@]
:-}
;
do
if
gcloud compute instance-templates describe
--project
"
${
PROJECT
}
"
"
${
template
}
"
&>/dev/null
;
then
gcloud compute instance-templates delete
\
--project
"
${
PROJECT
}
"
\
--quiet
\
"
${
template
}
"
fi
done
# First delete the master (if it exists).
if
gcloud compute instances describe
"
${
MASTER_NAME
}
"
--zone
"
${
ZONE
}
"
--project
"
${
PROJECT
}
"
&>/dev/null
;
then
...
...
@@ -1097,7 +1099,7 @@ function kube-down {
#
# $1: project
function
get-template
{
gcloud compute instance-templates list
"
${
NODE_INSTANCE_PREFIX
}
-template
"
\
gcloud compute instance-templates list
-r
"
${
NODE_INSTANCE_PREFIX
}
-template(-(
${
KUBE_RELEASE_VERSION_DASHED_REGEX
}
|
${
KUBE_CI_VERSION_DASHED_REGEX
}
))?
"
\
--project
=
"
${
1
}
"
--format
=
'value(name)'
}
...
...
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