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
bb233e22
Commit
bb233e22
authored
Sep 15, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the upgrade script to keep os distro during upgrade.
parent
9a342982
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
10 deletions
+42
-10
upgrade.sh
cluster/gce/upgrade.sh
+27
-1
util.sh
cluster/gce/util.sh
+15
-9
No files found.
cluster/gce/upgrade.sh
View file @
bb233e22
...
...
@@ -33,11 +33,12 @@ source "${KUBE_ROOT}/cluster/kube-util.sh"
function
usage
()
{
echo
"!!! EXPERIMENTAL !!!"
echo
""
echo
"
${
0
}
[-M|-N|-P] -l | <version number or publication>"
echo
"
${
0
}
[-M|-N|-P] -l
-o
| <version number or publication>"
echo
" Upgrades master and nodes by default"
echo
" -M: Upgrade master only"
echo
" -N: Upgrade nodes only"
echo
" -P: Node upgrade prerequisites only (create a new instance template)"
echo
" -o: Use os distro sepcified in KUBE_NODE_OS_DISTRIBUTION for new nodes"
echo
" -l: Use local(dev) binaries"
echo
""
echo
' Version number or publication is either a proper version number'
...
...
@@ -134,6 +135,20 @@ function get-node-env() {
'http://metadata/computeMetadata/v1/instance/attributes/kube-env'"
2>/dev/null
}
# Read os distro information from /os/release on node.
# $1: The name of node
#
# Assumed vars:
# PROJECT
# ZONE
function
get-node-os
()
{
gcloud compute ssh
"
$1
"
\
--project
"
${
PROJECT
}
"
\
--zone
"
${
ZONE
}
"
\
--command
\
"cat /etc/os-release | grep
\"
^ID=.*
\"
| cut -c 4-"
}
# Assumed vars:
# KUBE_VERSION
# NODE_SCOPES
...
...
@@ -199,6 +214,13 @@ function prepare-node-upgrade() {
# compatible way?
write-node-env
if
[[
"
${
env_os_distro
}
"
==
"false"
]]
;
then
NODE_OS_DISTRIBUTION
=
$(
get-node-os
"
${
NODE_NAMES
[0]
}
"
)
source
"
${
KUBE_ROOT
}
/cluster/gce/
${
NODE_OS_DISTRIBUTION
}
/node-helper.sh"
# Reset the node image based on current os distro
set-node-image
fi
# TODO(zmerlynn): Get configure-vm script from ${version}. (Must plumb this
# through all create-node-instance-template implementations).
local
template_name
=
$(
get-template-name-from-version
${
SANITIZED_VERSION
})
...
...
@@ -271,6 +293,7 @@ master_upgrade=true
node_upgrade
=
true
node_prereqs
=
false
local_binaries
=
false
env_os_distro
=
false
while
getopts
":MNPlh"
opt
;
do
case
${
opt
}
in
...
...
@@ -286,6 +309,9 @@ while getopts ":MNPlh" opt; do
l
)
local_binaries
=
true
;;
o
)
env_os_distro
=
true
;;
h
)
usage
exit
0
...
...
cluster/gce/util.sh
View file @
bb233e22
...
...
@@ -47,15 +47,21 @@ elif [[ "${MASTER_OS_DISTRIBUTION}" == "debian" ]]; then
MASTER_IMAGE_PROJECT
=
${
KUBE_GCE_MASTER_PROJECT
:-
google
-containers
}
fi
if
[[
"
${
NODE_OS_DISTRIBUTION
}
"
==
"gci"
]]
;
then
# If the node image is not set, we use the latest GCI image.
# Otherwise, we respect whatever is set by the user.
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
GCI_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
google
-containers
}
elif
[[
"
${
NODE_OS_DISTRIBUTION
}
"
==
"debian"
]]
;
then
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
CVM_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
google
-containers
}
fi
# Sets node image based on the specified os distro. Currently this function only
# supports gci and debian.
function
set-node-image
()
{
if
[[
"
${
NODE_OS_DISTRIBUTION
}
"
==
"gci"
]]
;
then
# If the node image is not set, we use the latest GCI image.
# Otherwise, we respect whatever is set by the user.
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
GCI_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
google
-containers
}
elif
[[
"
${
NODE_OS_DISTRIBUTION
}
"
==
"debian"
]]
;
then
NODE_IMAGE
=
${
KUBE_GCE_NODE_IMAGE
:-${
CVM_VERSION
}}
NODE_IMAGE_PROJECT
=
${
KUBE_GCE_NODE_PROJECT
:-
google
-containers
}
fi
}
set-node-image
# Verfiy cluster autoscaler configuration.
if
[[
"
${
ENABLE_CLUSTER_AUTOSCALER
}
"
==
"true"
]]
;
then
...
...
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