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
a49dc107
Commit
a49dc107
authored
Jan 09, 2019
by
Dmitry Rozhkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: drop applyFlags.newK8sVersion field
since it's not a command line flag. Use a variable instead.
parent
f7eb5769
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 @
a49dc107
...
@@ -55,7 +55,6 @@ type applyFlags struct {
...
@@ -55,7 +55,6 @@ type applyFlags struct {
etcdUpgrade
bool
etcdUpgrade
bool
criSocket
string
criSocket
string
newK8sVersionStr
string
newK8sVersionStr
string
newK8sVersion
*
version
.
Version
imagePullTimeout
time
.
Duration
imagePullTimeout
time
.
Duration
}
}
...
@@ -169,11 +168,10 @@ func runApply(flags *applyFlags) error {
...
@@ -169,11 +168,10 @@ func runApply(flags *applyFlags) error {
// Use normalized version string in all following code.
// Use normalized version string in all following code.
flags
.
newK8sVersionStr
=
cfg
.
KubernetesVersion
flags
.
newK8sVersionStr
=
cfg
.
KubernetesVersion
k8sVer
,
err
:=
version
.
ParseSemantic
(
flags
.
newK8sVersionStr
)
newK8sVersion
,
err
:=
version
.
ParseSemantic
(
cfg
.
KubernetesVersion
)
if
err
!=
nil
{
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
{
if
err
:=
features
.
ValidateVersion
(
features
.
InitFeatureGates
,
cfg
.
FeatureGates
,
cfg
.
KubernetesVersion
);
err
!=
nil
{
return
err
return
err
...
@@ -181,7 +179,7 @@ func runApply(flags *applyFlags) error {
...
@@ -181,7 +179,7 @@ func runApply(flags *applyFlags) error {
// Enforce the version skew policies
// Enforce the version skew policies
klog
.
V
(
1
)
.
Infof
(
"[upgrade/version] enforcing 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"
)
return
errors
.
Wrap
(
err
,
"[upgrade/version] FATAL"
)
}
}
...
@@ -214,7 +212,7 @@ func runApply(flags *applyFlags) error {
...
@@ -214,7 +212,7 @@ func runApply(flags *applyFlags) error {
// Upgrade RBAC rules and addons.
// Upgrade RBAC rules and addons.
klog
.
V
(
1
)
.
Infof
(
"[upgrade/postupgrade] upgrading 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"
)
return
errors
.
Wrap
(
err
,
"[upgrade/postupgrade] FATAL post-upgrade error"
)
}
}
...
@@ -242,10 +240,10 @@ func SetImplicitFlags(flags *applyFlags) error {
...
@@ -242,10 +240,10 @@ func SetImplicitFlags(flags *applyFlags) error {
// EnforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
// EnforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
// There are both fatal and skippable (with --force) errors
// 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
)
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
versionSkewErrs
!=
nil
{
if
len
(
versionSkewErrs
.
Mandatory
)
>
0
{
if
len
(
versionSkewErrs
.
Mandatory
)
>
0
{
...
...
cmd/kubeadm/app/cmd/upgrade/apply_test.go
View file @
a49dc107
...
@@ -48,11 +48,6 @@ func TestSetImplicitFlags(t *testing.T) {
...
@@ -48,11 +48,6 @@ func TestSetImplicitFlags(t *testing.T) {
t
.
Run
(
rt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
rt
.
name
,
func
(
t
*
testing
.
T
)
{
actualErr
:=
SetImplicitFlags
(
rt
.
flags
)
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
)
{
if
!
reflect
.
DeepEqual
(
*
rt
.
flags
,
rt
.
expectedFlags
)
{
t
.
Errorf
(
t
.
Errorf
(
"failed SetImplicitFlags:
\n\t
expected flags: %v
\n\t
actual: %v"
,
"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