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
5f4570b7
Commit
5f4570b7
authored
Sep 25, 2015
by
Vishnu kannan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling locks and update tests. Fail node if network is not initialized
parent
cf56f7a8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
kubelet.go
pkg/kubelet/kubelet.go
+6
-3
kubelet_test.go
pkg/kubelet/kubelet_test.go
+2
-2
runtime.go
pkg/kubelet/runtime.go
+3
-4
No files found.
pkg/kubelet/kubelet.go
View file @
5f4570b7
...
@@ -2425,15 +2425,18 @@ func (kl *Kubelet) syncNetworkStatus() {
...
@@ -2425,15 +2425,18 @@ func (kl *Kubelet) syncNetworkStatus() {
err
=
fmt
.
Errorf
(
"Error on adding ip table rules: %v"
,
err
)
err
=
fmt
.
Errorf
(
"Error on adding ip table rules: %v"
,
err
)
glog
.
Error
(
err
)
glog
.
Error
(
err
)
}
}
if
len
(
kl
.
podCIDR
)
==
0
{
kl
.
networkConfigMutex
.
Lock
()
podCIDR
:=
kl
.
podCIDR
kl
.
networkConfigMutex
.
Unlock
()
if
len
(
podCIDR
)
==
0
{
err
=
fmt
.
Errorf
(
"ConfigureCBR0 requested, but PodCIDR not set. Will not configure CBR0 right now"
)
err
=
fmt
.
Errorf
(
"ConfigureCBR0 requested, but PodCIDR not set. Will not configure CBR0 right now"
)
glog
.
Warning
(
err
)
glog
.
Warning
(
err
)
}
else
if
err
:=
kl
.
reconcileCBR0
(
kl
.
podCIDR
);
err
!=
nil
{
}
else
if
err
:=
kl
.
reconcileCBR0
(
podCIDR
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Error configuring cbr0: %v"
,
err
)
err
=
fmt
.
Errorf
(
"Error configuring cbr0: %v"
,
err
)
glog
.
Error
(
err
)
glog
.
Error
(
err
)
}
}
}
}
kl
.
runtimeState
.
setNetwork
Error
(
err
)
kl
.
runtimeState
.
setNetwork
State
(
err
)
}
}
// setNodeStatus fills in the Status fields of the given Node, overwriting
// setNodeStatus fills in the Status fields of the given Node, overwriting
...
...
pkg/kubelet/kubelet_test.go
View file @
5f4570b7
...
@@ -140,7 +140,7 @@ func newTestKubelet(t *testing.T) *TestKubelet {
...
@@ -140,7 +140,7 @@ func newTestKubelet(t *testing.T) *TestKubelet {
kubelet
.
volumeManager
=
newVolumeManager
()
kubelet
.
volumeManager
=
newVolumeManager
()
kubelet
.
containerManager
,
_
=
newContainerManager
(
fakeContainerMgrMountInt
(),
mockCadvisor
,
""
,
""
,
""
)
kubelet
.
containerManager
,
_
=
newContainerManager
(
fakeContainerMgrMountInt
(),
mockCadvisor
,
""
,
""
,
""
)
kubelet
.
runtimeState
.
setNetwork
Error
(
nil
)
kubelet
.
runtimeState
.
setNetwork
State
(
nil
)
fakeClock
:=
&
util
.
FakeClock
{
Time
:
time
.
Now
()}
fakeClock
:=
&
util
.
FakeClock
{
Time
:
time
.
Now
()}
kubelet
.
backOff
=
util
.
NewBackOff
(
time
.
Second
,
time
.
Minute
)
kubelet
.
backOff
=
util
.
NewBackOff
(
time
.
Second
,
time
.
Minute
)
kubelet
.
backOff
.
Clock
=
fakeClock
kubelet
.
backOff
.
Clock
=
fakeClock
...
@@ -2996,8 +2996,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
...
@@ -2996,8 +2996,8 @@ func TestUpdateNodeStatusWithoutContainerRuntime(t *testing.T) {
},
},
},
},
}
}
kubelet
.
runtimeState
=
newRuntimeState
(
time
.
Duration
(
0
))
kubelet
.
runtimeState
=
newRuntimeState
(
time
.
Duration
(
0
))
kubelet
.
runtimeState
.
setNetworkState
(
nil
)
kubelet
.
updateRuntimeUp
()
kubelet
.
updateRuntimeUp
()
if
err
:=
kubelet
.
updateNodeStatus
();
err
!=
nil
{
if
err
:=
kubelet
.
updateNodeStatus
();
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %v"
,
err
)
t
.
Errorf
(
"unexpected error: %v"
,
err
)
...
...
pkg/kubelet/runtime.go
View file @
5f4570b7
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
kubelet
package
kubelet
import
(
import
(
"fmt"
"sync"
"sync"
"time"
"time"
)
)
...
@@ -35,10 +36,7 @@ func (s *runtimeState) setRuntimeSync(t time.Time) {
...
@@ -35,10 +36,7 @@ func (s *runtimeState) setRuntimeSync(t time.Time) {
s
.
lastBaseRuntimeSync
=
t
s
.
lastBaseRuntimeSync
=
t
}
}
func
(
s
*
runtimeState
)
setNetworkError
(
err
error
)
{
func
(
s
*
runtimeState
)
setNetworkState
(
err
error
)
{
if
err
==
nil
{
return
}
s
.
Lock
()
s
.
Lock
()
defer
s
.
Unlock
()
defer
s
.
Unlock
()
s
.
networkError
=
err
s
.
networkError
=
err
...
@@ -70,5 +68,6 @@ func newRuntimeState(runtimeSyncThreshold time.Duration) *runtimeState {
...
@@ -70,5 +68,6 @@ func newRuntimeState(runtimeSyncThreshold time.Duration) *runtimeState {
return
&
runtimeState
{
return
&
runtimeState
{
lastBaseRuntimeSync
:
time
.
Time
{},
lastBaseRuntimeSync
:
time
.
Time
{},
baseRuntimeSyncThreshold
:
runtimeSyncThreshold
,
baseRuntimeSyncThreshold
:
runtimeSyncThreshold
,
networkError
:
fmt
.
Errorf
(
"network state unknown"
),
}
}
}
}
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