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
98918243
Unverified
Commit
98918243
authored
Feb 18, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 18, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74212 from rojkov/kubeadm-drop-applyFlags-newK8sVersion
kubeadm: drop applyFlags.newK8sVersion field
parents
c923a684
a49dc107
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
apply.go
cmd/kubeadm/app/cmd/upgrade/apply.go
+6
-8
apply_test.go
cmd/kubeadm/app/cmd/upgrade/apply_test.go
+0
-5
No files found.
cmd/kubeadm/app/cmd/upgrade/apply.go
View file @
98918243
...
...
@@ -55,7 +55,6 @@ type applyFlags struct {
etcdUpgrade
bool
criSocket
string
newK8sVersionStr
string
newK8sVersion
*
version
.
Version
imagePullTimeout
time
.
Duration
}
...
...
@@ -169,11 +168,10 @@ func runApply(flags *applyFlags) error {
// Use normalized version string in all following code.
flags
.
newK8sVersionStr
=
cfg
.
KubernetesVersion
k8sVer
,
err
:=
version
.
ParseSemantic
(
flags
.
newK8sVersionStr
)
newK8sVersion
,
err
:=
version
.
ParseSemantic
(
cfg
.
KubernetesVersion
)
if
err
!=
nil
{
return
errors
.
Errorf
(
"unable to parse normalized version %q as a semantic version"
,
flags
.
newK8sVersionStr
)
return
errors
.
Errorf
(
"unable to parse normalized version %q as a semantic version"
,
cfg
.
KubernetesVersion
)
}
flags
.
newK8sVersion
=
k8sVer
if
err
:=
features
.
ValidateVersion
(
features
.
InitFeatureGates
,
cfg
.
FeatureGates
,
cfg
.
KubernetesVersion
);
err
!=
nil
{
return
err
...
...
@@ -181,7 +179,7 @@ func runApply(flags *applyFlags) error {
// Enforce the version skew policies
klog
.
V
(
1
)
.
Infof
(
"[upgrade/version] enforcing version skew policies"
)
if
err
:=
EnforceVersionPolicies
(
flags
,
versionGetter
);
err
!=
nil
{
if
err
:=
EnforceVersionPolicies
(
newK8sVersion
,
flags
,
versionGetter
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"[upgrade/version] FATAL"
)
}
...
...
@@ -214,7 +212,7 @@ func runApply(flags *applyFlags) error {
// Upgrade RBAC rules and addons.
klog
.
V
(
1
)
.
Infof
(
"[upgrade/postupgrade] upgrading RBAC rules and addons"
)
if
err
:=
upgrade
.
PerformPostUpgradeTasks
(
client
,
cfg
,
flags
.
newK8sVersion
,
flags
.
dryRun
);
err
!=
nil
{
if
err
:=
upgrade
.
PerformPostUpgradeTasks
(
client
,
cfg
,
newK8sVersion
,
flags
.
dryRun
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"[upgrade/postupgrade] FATAL post-upgrade error"
)
}
...
...
@@ -242,10 +240,10 @@ func SetImplicitFlags(flags *applyFlags) error {
// EnforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
// There are both fatal and skippable (with --force) errors
func
EnforceVersionPolicies
(
flags
*
applyFlags
,
versionGetter
upgrade
.
VersionGetter
)
error
{
func
EnforceVersionPolicies
(
newK8sVersion
*
version
.
Version
,
flags
*
applyFlags
,
versionGetter
upgrade
.
VersionGetter
)
error
{
fmt
.
Printf
(
"[upgrade/version] You have chosen to change the cluster version to %q
\n
"
,
flags
.
newK8sVersionStr
)
versionSkewErrs
:=
upgrade
.
EnforceVersionPolicies
(
versionGetter
,
flags
.
newK8sVersionStr
,
flags
.
newK8sVersion
,
flags
.
allowExperimentalUpgrades
,
flags
.
allowRCUpgrades
)
versionSkewErrs
:=
upgrade
.
EnforceVersionPolicies
(
versionGetter
,
flags
.
newK8sVersionStr
,
newK8sVersion
,
flags
.
allowExperimentalUpgrades
,
flags
.
allowRCUpgrades
)
if
versionSkewErrs
!=
nil
{
if
len
(
versionSkewErrs
.
Mandatory
)
>
0
{
...
...
cmd/kubeadm/app/cmd/upgrade/apply_test.go
View file @
98918243
...
...
@@ -48,11 +48,6 @@ func TestSetImplicitFlags(t *testing.T) {
t
.
Run
(
rt
.
name
,
func
(
t
*
testing
.
T
)
{
actualErr
:=
SetImplicitFlags
(
rt
.
flags
)
// If an error was returned; make newK8sVersion nil so it's easy to match using reflect.DeepEqual later (instead of a random pointer)
if
actualErr
!=
nil
{
rt
.
flags
.
newK8sVersion
=
nil
}
if
!
reflect
.
DeepEqual
(
*
rt
.
flags
,
rt
.
expectedFlags
)
{
t
.
Errorf
(
"failed SetImplicitFlags:
\n\t
expected flags: %v
\n\t
actual: %v"
,
...
...
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