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
ad6d842a
Commit
ad6d842a
authored
Sep 22, 2016
by
Justin Santa Barbara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create hostNetwork pods even if network plugin not ready
parent
714f816a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
6 deletions
+21
-6
kubelet.go
pkg/kubelet/kubelet.go
+7
-1
kubelet_node_status.go
pkg/kubelet/kubelet_node_status.go
+2
-1
runonce_test.go
pkg/kubelet/runonce_test.go
+1
-0
runtime.go
pkg/kubelet/runtime.go
+11
-4
No files found.
pkg/kubelet/kubelet.go
View file @
ad6d842a
...
...
@@ -1505,6 +1505,12 @@ func (kl *Kubelet) rejectPod(pod *api.Pod, reason, message string) {
// can be admitted, a brief single-word reason and a message explaining why
// the pod cannot be admitted.
func
(
kl
*
Kubelet
)
canAdmitPod
(
pods
[]
*
api
.
Pod
,
pod
*
api
.
Pod
)
(
bool
,
string
,
string
)
{
if
rs
:=
kl
.
runtimeState
.
networkErrors
();
len
(
rs
)
!=
0
{
if
!
podUsesHostNetwork
(
pod
)
{
return
false
,
"NetworkNotReady"
,
fmt
.
Sprintf
(
"Network is not ready: %v"
,
rs
)
}
}
// the kubelet will invoke each pod admit handler in sequence
// if any handler rejects, the pod is rejected.
// TODO: move out of disk check into a pod admitter
...
...
@@ -1541,7 +1547,7 @@ func (kl *Kubelet) syncLoop(updates <-chan kubetypes.PodUpdate, handler SyncHand
defer
housekeepingTicker
.
Stop
()
plegCh
:=
kl
.
pleg
.
Watch
()
for
{
if
rs
:=
kl
.
runtimeState
.
e
rrors
();
len
(
rs
)
!=
0
{
if
rs
:=
kl
.
runtimeState
.
runtimeE
rrors
();
len
(
rs
)
!=
0
{
glog
.
Infof
(
"skipping pod synchronization - %v"
,
rs
)
time
.
Sleep
(
5
*
time
.
Second
)
continue
...
...
pkg/kubelet/kubelet_node_status.go
View file @
ad6d842a
...
...
@@ -552,7 +552,8 @@ func (kl *Kubelet) setNodeReadyCondition(node *api.Node) {
// ref: https://github.com/kubernetes/kubernetes/issues/16961
currentTime
:=
unversioned
.
NewTime
(
kl
.
clock
.
Now
())
var
newNodeReadyCondition
api
.
NodeCondition
if
rs
:=
kl
.
runtimeState
.
errors
();
len
(
rs
)
==
0
{
rs
:=
append
(
kl
.
runtimeState
.
runtimeErrors
(),
kl
.
runtimeState
.
networkErrors
()
...
)
if
len
(
rs
)
==
0
{
newNodeReadyCondition
=
api
.
NodeCondition
{
Type
:
api
.
NodeReady
,
Status
:
api
.
ConditionTrue
,
...
...
pkg/kubelet/runonce_test.go
View file @
ad6d842a
...
...
@@ -83,6 +83,7 @@ func TestRunOnce(t *testing.T) {
kubeClient
:
&
fake
.
Clientset
{},
hostname
:
testKubeletHostname
,
nodeName
:
testKubeletHostname
,
runtimeState
:
newRuntimeState
(
time
.
Second
),
}
kb
.
containerManager
=
cm
.
NewStubContainerManager
()
...
...
pkg/kubelet/runtime.go
View file @
ad6d842a
...
...
@@ -68,16 +68,13 @@ func (s *runtimeState) setInitError(err error) {
s
.
initError
=
err
}
func
(
s
*
runtimeState
)
e
rrors
()
[]
string
{
func
(
s
*
runtimeState
)
runtimeE
rrors
()
[]
string
{
s
.
RLock
()
defer
s
.
RUnlock
()
var
ret
[]
string
if
s
.
initError
!=
nil
{
ret
=
append
(
ret
,
s
.
initError
.
Error
())
}
if
s
.
networkError
!=
nil
{
ret
=
append
(
ret
,
s
.
networkError
.
Error
())
}
if
!
s
.
lastBaseRuntimeSync
.
Add
(
s
.
baseRuntimeSyncThreshold
)
.
After
(
time
.
Now
())
{
ret
=
append
(
ret
,
"container runtime is down"
)
}
...
...
@@ -87,6 +84,16 @@ func (s *runtimeState) errors() []string {
return
ret
}
func
(
s
*
runtimeState
)
networkErrors
()
[]
string
{
s
.
RLock
()
defer
s
.
RUnlock
()
var
ret
[]
string
if
s
.
networkError
!=
nil
{
ret
=
append
(
ret
,
s
.
networkError
.
Error
())
}
return
ret
}
func
newRuntimeState
(
runtimeSyncThreshold
time
.
Duration
,
)
*
runtimeState
{
...
...
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