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
3f47fc2f
Commit
3f47fc2f
authored
Jul 23, 2015
by
Vish Kannan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11762 from mbforbes/rollingAlpha
Support gcloud rolling-update command in 'preview' and 'alpha compute'
parents
a02252dc
5ff1566a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
7 deletions
+35
-7
upgrade.sh
cluster/gce/upgrade.sh
+9
-2
cluster_upgrade.go
test/e2e/cluster_upgrade.go
+26
-5
No files found.
cluster/gce/upgrade.sh
View file @
3f47fc2f
...
@@ -212,8 +212,15 @@ function do-node-upgrade() {
...
@@ -212,8 +212,15 @@ function do-node-upgrade() {
echo
"== Upgrading nodes to
${
KUBE_VERSION
}
. =="
>
&2
echo
"== Upgrading nodes to
${
KUBE_VERSION
}
. =="
>
&2
# Do the actual upgrade.
# Do the actual upgrade.
# NOTE(mbforbes): If you are changing this gcloud command, update
# NOTE(mbforbes): If you are changing this gcloud command, update
# test/e2e/restart.go to match this EXACTLY.
# test/e2e/cluster_upgrade.go to match this EXACTLY.
gcloud preview rolling-updates
\
# TODO(mbforbes): Remove this hack on July 29, 2015, when the migration to
# `gcloud alpha compute rolling-updates` is complete.
local
subgroup
=
"preview"
local
exists
=
$(
gcloud
${
subgroup
}
rolling-updates
-h
&>/dev/null
;
echo
$?
)
||
true
if
[[
"
${
exists
}
"
!=
"0"
]]
;
then
subgroup
=
"alpha compute"
fi
gcloud
${
subgroup
}
rolling-updates
\
--project
=
"
${
PROJECT
}
"
\
--project
=
"
${
PROJECT
}
"
\
--zone
=
"
${
ZONE
}
"
\
--zone
=
"
${
ZONE
}
"
\
start
\
start
\
...
...
test/e2e/cluster_upgrade.go
View file @
3f47fc2f
...
@@ -567,7 +567,8 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
...
@@ -567,7 +567,8 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
// shelling out to gcloud.
// shelling out to gcloud.
// NOTE(mbforbes): If you are changing this gcloud command, update
// NOTE(mbforbes): If you are changing this gcloud command, update
// cluster/gce/upgrade.sh to match this EXACTLY.
// cluster/gce/upgrade.sh to match this EXACTLY.
o
,
err
:=
exec
.
Command
(
"gcloud"
,
"preview"
,
"rolling-updates"
,
o
,
err
:=
exec
.
Command
(
"gcloud"
,
append
(
migUdpateCmdBase
(),
"rolling-updates"
,
fmt
.
Sprintf
(
"--project=%s"
,
testContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--project=%s"
,
testContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--zone=%s"
,
testContext
.
CloudConfig
.
Zone
),
fmt
.
Sprintf
(
"--zone=%s"
,
testContext
.
CloudConfig
.
Zone
),
"start"
,
"start"
,
...
@@ -580,9 +581,9 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
...
@@ -580,9 +581,9 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
// --max-num-concurrent-instances.
// --max-num-concurrent-instances.
fmt
.
Sprintf
(
"--max-num-concurrent-instances=%d"
,
1
),
fmt
.
Sprintf
(
"--max-num-concurrent-instances=%d"
,
1
),
fmt
.
Sprintf
(
"--max-num-failed-instances=%d"
,
0
),
fmt
.
Sprintf
(
"--max-num-failed-instances=%d"
,
0
),
fmt
.
Sprintf
(
"--min-instance-update-time=%ds"
,
0
))
.
CombinedOutput
()
fmt
.
Sprintf
(
"--min-instance-update-time=%ds"
,
0
))
.
..
)
.
CombinedOutput
()
if
err
!=
nil
{
if
err
!=
nil
{
errLast
=
fmt
.
Errorf
(
"
gcloud preview
rolling-updates call failed with err: %v"
,
err
)
errLast
=
fmt
.
Errorf
(
"rolling-updates call failed with err: %v"
,
err
)
return
false
,
nil
return
false
,
nil
}
}
output
:=
string
(
o
)
output
:=
string
(
o
)
...
@@ -609,6 +610,25 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
...
@@ -609,6 +610,25 @@ func migRollingUpdateStart(templ string, nt time.Duration) (string, error) {
return
id
,
nil
return
id
,
nil
}
}
// migUpdateCmdBase gets the base of the MIG rolling update command--i.e., all
// pieces of the gcloud command that come after "gcloud" but before
// "rolling-updates". Examples of returned values are:
//
// {preview"}
//
// {"alpha", "compute"}
//
// TODO(mbforbes): Remove this hack on July 29, 2015 when the migration to
// `gcloud alpha compute rolling-updates` is complete.
func
migUdpateCmdBase
()
[]
string
{
b
:=
[]
string
{
"preview"
}
a
:=
[]
string
{
"rolling-updates"
,
"-h"
}
if
err
:=
exec
.
Command
(
"gcloud"
,
append
(
b
,
a
...
)
...
)
.
Run
();
err
!=
nil
{
b
=
[]
string
{
"alpha"
,
"compute"
}
}
return
b
}
// migRollingUpdatePoll (CKE/GKE-only) polls the progress of the MIG rolling
// migRollingUpdatePoll (CKE/GKE-only) polls the progress of the MIG rolling
// update with ID id until it is complete. It returns an error if this takes
// update with ID id until it is complete. It returns an error if this takes
// longer than nt times the number of nodes.
// longer than nt times the number of nodes.
...
@@ -620,11 +640,12 @@ func migRollingUpdatePoll(id string, nt time.Duration) error {
...
@@ -620,11 +640,12 @@ func migRollingUpdatePoll(id string, nt time.Duration) error {
Logf
(
"Waiting up to %v for MIG rolling update to complete."
,
timeout
)
Logf
(
"Waiting up to %v for MIG rolling update to complete."
,
timeout
)
// TODO(mbforbes): Refactor this to use cluster_upgrade.go:retryCmd(...)
// TODO(mbforbes): Refactor this to use cluster_upgrade.go:retryCmd(...)
if
wait
.
Poll
(
restartPoll
,
timeout
,
func
()
(
bool
,
error
)
{
if
wait
.
Poll
(
restartPoll
,
timeout
,
func
()
(
bool
,
error
)
{
o
,
err
:=
exec
.
Command
(
"gcloud"
,
"preview"
,
"rolling-updates"
,
o
,
err
:=
exec
.
Command
(
"gcloud"
,
append
(
migUdpateCmdBase
(),
"rolling-updates"
,
fmt
.
Sprintf
(
"--project=%s"
,
testContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--project=%s"
,
testContext
.
CloudConfig
.
ProjectID
),
fmt
.
Sprintf
(
"--zone=%s"
,
testContext
.
CloudConfig
.
Zone
),
fmt
.
Sprintf
(
"--zone=%s"
,
testContext
.
CloudConfig
.
Zone
),
"describe"
,
"describe"
,
id
)
.
CombinedOutput
()
id
)
.
..
)
.
CombinedOutput
()
if
err
!=
nil
{
if
err
!=
nil
{
errLast
=
fmt
.
Errorf
(
"Error calling rolling-updates describe %s: %v"
,
id
,
err
)
errLast
=
fmt
.
Errorf
(
"Error calling rolling-updates describe %s: %v"
,
id
,
err
)
Logf
(
"%v"
,
errLast
)
Logf
(
"%v"
,
errLast
)
...
...
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