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
bb9a12d6
Unverified
Commit
bb9a12d6
authored
Jan 29, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73487 from ereslibre/phases-cleanup
kubeadm: cleanup of phases arguments
parents
b8b689aa
1bd15658
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
init.go
cmd/kubeadm/app/cmd/init.go
+10
-9
join.go
cmd/kubeadm/app/cmd/join.go
+6
-4
runner.go
cmd/kubeadm/app/cmd/phases/workflow/runner.go
+5
-2
No files found.
cmd/kubeadm/app/cmd/init.go
View file @
bb9a12d6
...
...
@@ -148,6 +148,7 @@ func NewCmdInit(out io.Writer, initOptions *initOptions) *cobra.Command {
err
=
showJoinCommand
(
data
,
out
)
kubeadmutil
.
CheckErr
(
err
)
},
Args
:
cobra
.
NoArgs
,
}
// adds flags to the init command
...
...
@@ -286,27 +287,27 @@ func newInitData(cmd *cobra.Command, args []string, options *initOptions, out io
// validated values to the public kubeadm config API when applicable
var
err
error
if
options
.
externalcfg
.
FeatureGates
,
err
=
features
.
NewFeatureGate
(
&
features
.
InitFeatureGates
,
options
.
featureGatesString
);
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
ignorePreflightErrorsSet
,
err
:=
validation
.
ValidateIgnorePreflightErrors
(
options
.
ignorePreflightErrors
)
if
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
if
err
=
validation
.
ValidateMixedArguments
(
cmd
.
Flags
());
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
if
err
=
options
.
bto
.
ApplyTo
(
options
.
externalcfg
);
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
// Either use the config file if specified, or convert public kubeadm API to the internal InitConfiguration
// and validates InitConfiguration
cfg
,
err
:=
configutil
.
ConfigFileAndDefaultsToInternalConfig
(
options
.
cfgPath
,
options
.
externalcfg
)
if
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
// override node name and CRI socket from the command line options
...
...
@@ -318,17 +319,17 @@ func newInitData(cmd *cobra.Command, args []string, options *initOptions, out io
}
if
err
:=
configutil
.
VerifyAPIServerBindAddress
(
cfg
.
LocalAPIEndpoint
.
AdvertiseAddress
);
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
if
err
:=
features
.
ValidateVersion
(
features
.
InitFeatureGates
,
cfg
.
FeatureGates
,
cfg
.
KubernetesVersion
);
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
// if dry running creates a temporary folder for saving kubeadm generated files
dryRunDir
:=
""
if
options
.
dryRun
{
if
dryRunDir
,
err
=
ioutil
.
TempDir
(
""
,
"kubeadm-init-dryrun"
);
err
!=
nil
{
return
&
initData
{}
,
errors
.
Wrap
(
err
,
"couldn't create a temporary directory"
)
return
nil
,
errors
.
Wrap
(
err
,
"couldn't create a temporary directory"
)
}
}
...
...
@@ -340,7 +341,7 @@ func newInitData(cmd *cobra.Command, args []string, options *initOptions, out io
kubeconfigDir
=
dryRunDir
}
if
err
:=
kubeconfigphase
.
ValidateKubeconfigsForExternalCA
(
kubeconfigDir
,
cfg
);
err
!=
nil
{
return
&
initData
{}
,
err
return
nil
,
err
}
}
...
...
cmd/kubeadm/app/cmd/join.go
View file @
bb9a12d6
...
...
@@ -203,6 +203,8 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
err
=
data
.
Run
()
kubeadmutil
.
CheckErr
(
err
)
},
// We accept the master location as an optional positional argument
Args
:
cobra
.
MaximumNArgs
(
1
),
}
AddJoinConfigFlags
(
cmd
.
Flags
(),
joinOptions
.
externalcfg
)
...
...
@@ -358,11 +360,11 @@ func newJoinData(cmd *cobra.Command, args []string, options *joinOptions, out io
ignorePreflightErrorsSet
,
err
:=
validation
.
ValidateIgnorePreflightErrors
(
options
.
ignorePreflightErrors
)
if
err
!=
nil
{
return
&
joinData
{}
,
err
return
nil
,
err
}
if
err
=
validation
.
ValidateMixedArguments
(
cmd
.
Flags
());
err
!=
nil
{
return
&
joinData
{}
,
err
return
nil
,
err
}
// Either use the config file if specified, or convert public kubeadm API to the internal JoinConfiguration
...
...
@@ -377,7 +379,7 @@ func newJoinData(cmd *cobra.Command, args []string, options *joinOptions, out io
cfg
,
err
:=
configutil
.
JoinConfigFileAndDefaultsToInternalConfig
(
options
.
cfgPath
,
options
.
externalcfg
)
if
err
!=
nil
{
return
&
joinData
{}
,
err
return
nil
,
err
}
// override node name and CRI socket from the command line options
...
...
@@ -390,7 +392,7 @@ func newJoinData(cmd *cobra.Command, args []string, options *joinOptions, out io
if
cfg
.
ControlPlane
!=
nil
{
if
err
:=
configutil
.
VerifyAPIServerBindAddress
(
cfg
.
ControlPlane
.
LocalAPIEndpoint
.
AdvertiseAddress
);
err
!=
nil
{
return
&
joinData
{}
,
err
return
nil
,
err
}
}
...
...
cmd/kubeadm/app/cmd/phases/workflow/runner.go
View file @
bb9a12d6
...
...
@@ -309,7 +309,6 @@ func (e *Runner) BindToCommand(cmd *cobra.Command) {
phaseCommand
:=
&
cobra
.
Command
{
Use
:
"phase"
,
Short
:
fmt
.
Sprintf
(
"use this command to invoke single phase of the %s workflow"
,
cmd
.
Name
()),
// TODO: this logic is currently lacking verification if a suphase name is valid!
}
cmd
.
AddCommand
(
phaseCommand
)
...
...
@@ -352,7 +351,6 @@ func (e *Runner) BindToCommand(cmd *cobra.Command) {
os
.
Exit
(
1
)
}
},
Args
:
cobra
.
NoArgs
,
// this forces cobra to fail if a wrong phase name is passed
}
// makes the new command inherits local flags from the parent command
...
...
@@ -371,6 +369,11 @@ func (e *Runner) BindToCommand(cmd *cobra.Command) {
})
}
// if this phase has children (not a leaf) it doesn't accept any args
if
len
(
p
.
Phases
)
>
0
{
phaseCmd
.
Args
=
cobra
.
NoArgs
}
// adds the command to parent
if
p
.
level
==
0
{
phaseCommand
.
AddCommand
(
phaseCmd
)
...
...
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