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
cf000bff
Unverified
Commit
cf000bff
authored
Oct 14, 2016
by
Paulo Pires
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: fix preflight checks.
parent
928b8cbd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
24 deletions
+15
-24
init.go
cmd/kubeadm/app/cmd/init.go
+6
-12
join.go
cmd/kubeadm/app/cmd/join.go
+1
-1
checks.go
cmd/kubeadm/app/preflight/checks.go
+8
-11
No files found.
cmd/kubeadm/app/cmd/init.go
View file @
cf000bff
...
@@ -27,7 +27,6 @@ import (
...
@@ -27,7 +27,6 @@ import (
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubemaster
"k8s.io/kubernetes/cmd/kubeadm/app/master"
kubemaster
"k8s.io/kubernetes/cmd/kubeadm/app/master"
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider"
...
@@ -55,14 +54,9 @@ func NewCmdInit(out io.Writer) *cobra.Command {
...
@@ -55,14 +54,9 @@ func NewCmdInit(out io.Writer) *cobra.Command {
Use
:
"init"
,
Use
:
"init"
,
Short
:
"Run this in order to set up the Kubernetes master."
,
Short
:
"Run this in order to set up the Kubernetes master."
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
check
:=
func
(
err
error
)
{
if
err
!=
nil
{
cmdutil
.
CheckErr
(
fmt
.
Errorf
(
"<cmd/init> %v"
,
err
))
}
}
i
,
err
:=
NewInit
(
cfgPath
,
cfg
,
skipPreFlight
)
i
,
err
:=
NewInit
(
cfgPath
,
cfg
,
skipPreFlight
)
check
(
err
)
kubeadmutil
.
CheckErr
(
err
)
check
(
i
.
Run
(
out
))
kubeadmutil
.
CheckErr
(
i
.
Run
(
out
))
},
},
}
}
...
@@ -126,6 +120,7 @@ func NewCmdInit(out io.Writer) *cobra.Command {
...
@@ -126,6 +120,7 @@ func NewCmdInit(out io.Writer) *cobra.Command {
"etcd client key file. Note: The path must be in /etc/ssl/certs"
,
"etcd client key file. Note: The path must be in /etc/ssl/certs"
,
)
)
cmd
.
PersistentFlags
()
.
MarkDeprecated
(
"external-etcd-keyfile"
,
"this flag will be removed when componentconfig exists"
)
cmd
.
PersistentFlags
()
.
MarkDeprecated
(
"external-etcd-keyfile"
,
"this flag will be removed when componentconfig exists"
)
cmd
.
PersistentFlags
()
.
BoolVar
(
cmd
.
PersistentFlags
()
.
BoolVar
(
&
skipPreFlight
,
"skip-preflight-checks"
,
false
,
&
skipPreFlight
,
"skip-preflight-checks"
,
false
,
"skip preflight checks normally run before modifying the system"
,
"skip preflight checks normally run before modifying the system"
,
...
@@ -150,10 +145,10 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
...
@@ -150,10 +145,10 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
}
}
if
!
skipPreFlight
{
if
!
skipPreFlight
{
fmt
.
Println
(
"
<cmd/init>
Running pre-flight checks"
)
fmt
.
Println
(
"Running pre-flight checks"
)
err
:=
preflight
.
RunInitMasterChecks
()
err
:=
preflight
.
RunInitMasterChecks
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
&
preflight
.
PreFlightError
{
Msg
:
err
.
Error
()}
}
}
}
else
{
}
else
{
fmt
.
Println
(
"Skipping pre-flight checks"
)
fmt
.
Println
(
"Skipping pre-flight checks"
)
...
@@ -180,9 +175,8 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
...
@@ -180,9 +175,8 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight
return
&
Init
{
cfg
:
cfg
},
nil
return
&
Init
{
cfg
:
cfg
},
nil
}
}
// Run
Init
executes master node provisioning, including certificates, needed static pod manifests, etc.
// Run executes master node provisioning, including certificates, needed static pod manifests, etc.
func
(
i
*
Init
)
Run
(
out
io
.
Writer
)
error
{
func
(
i
*
Init
)
Run
(
out
io
.
Writer
)
error
{
if
err
:=
kubemaster
.
CreateTokenAuthFile
(
&
i
.
cfg
.
Secrets
);
err
!=
nil
{
if
err
:=
kubemaster
.
CreateTokenAuthFile
(
&
i
.
cfg
.
Secrets
);
err
!=
nil
{
return
err
return
err
}
}
...
...
cmd/kubeadm/app/cmd/join.go
View file @
cf000bff
...
@@ -73,7 +73,7 @@ func RunJoin(out io.Writer, cmd *cobra.Command, args []string, s *kubeadmapi.Nod
...
@@ -73,7 +73,7 @@ func RunJoin(out io.Writer, cmd *cobra.Command, args []string, s *kubeadmapi.Nod
fmt
.
Println
(
"Running pre-flight checks"
)
fmt
.
Println
(
"Running pre-flight checks"
)
err
:=
preflight
.
RunJoinNodeChecks
()
err
:=
preflight
.
RunJoinNodeChecks
()
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
&
preflight
.
PreFlightError
{
Msg
:
err
.
Error
()}
}
}
}
else
{
}
else
{
fmt
.
Println
(
"Skipping pre-flight checks"
)
fmt
.
Println
(
"Skipping pre-flight checks"
)
...
...
cmd/kubeadm/app/preflight/checks.go
View file @
cf000bff
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
preflight
package
preflight
import
(
import
(
"errors"
"fmt"
"fmt"
"io"
"io"
"net"
"net"
...
@@ -28,11 +29,10 @@ import (
...
@@ -28,11 +29,10 @@ import (
type
PreFlightError
struct
{
type
PreFlightError
struct
{
Msg
string
Msg
string
Count
int
}
}
func
(
e
*
PreFlightError
)
Error
()
string
{
func
(
e
*
PreFlightError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"preflight check error
\n
count: %d
\n
msg: %s"
,
e
.
Count
,
e
.
Msg
)
return
fmt
.
Sprintf
(
"preflight check error
s:
\n
%s"
,
e
.
Msg
)
}
}
// PreFlightCheck validates the state of the system to ensure kubeadm will be
// PreFlightCheck validates the state of the system to ensure kubeadm will be
...
@@ -216,23 +216,20 @@ func RunJoinNodeChecks() error {
...
@@ -216,23 +216,20 @@ func RunJoinNodeChecks() error {
func
runChecks
(
checks
[]
PreFlightCheck
)
error
{
func
runChecks
(
checks
[]
PreFlightCheck
)
error
{
found
:=
[]
error
{}
found
:=
[]
error
{}
for
_
,
c
:=
range
checks
{
for
_
,
c
:=
range
checks
{
warnings
,
err
or
s
:=
c
.
Check
()
warnings
,
errs
:=
c
.
Check
()
for
_
,
w
:=
range
warnings
{
for
_
,
w
:=
range
warnings
{
fmt
.
Printf
(
"
<preflight/checks>
WARNING: %s
\n
"
,
w
)
fmt
.
Printf
(
"WARNING: %s
\n
"
,
w
)
}
}
for
_
,
e
:=
range
err
or
s
{
for
_
,
e
:=
range
errs
{
found
=
append
(
found
,
e
)
found
=
append
(
found
,
e
)
}
}
}
}
if
len
(
found
)
>
0
{
if
len
(
found
)
>
0
{
err
ors
:=
"
\n
"
err
s
:=
"
"
for
_
,
i
:=
range
found
{
for
_
,
i
:=
range
found
{
errors
+=
"
\t
"
+
i
.
Error
()
+
"
\n
"
errs
+=
"
\t
"
+
i
.
Error
()
+
"
\n
"
}
return
&
PreFlightError
{
Msg
:
errors
,
Count
:
len
(
found
),
}
}
return
errors
.
New
(
errs
)
}
}
return
nil
return
nil
}
}
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