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
e9dceb36
Commit
e9dceb36
authored
Jan 12, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start using reason cache in kubelet
parent
123fec8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
kubelet.go
pkg/kubelet/kubelet.go
+7
-2
kubelet_test.go
pkg/kubelet/kubelet_test.go
+1
-0
No files found.
pkg/kubelet/kubelet.go
View file @
e9dceb36
...
@@ -441,6 +441,7 @@ func NewMainKubelet(
...
@@ -441,6 +441,7 @@ func NewMainKubelet(
return
nil
,
err
return
nil
,
err
}
}
klet
.
runtimeCache
=
runtimeCache
klet
.
runtimeCache
=
runtimeCache
klet
.
reasonCache
=
NewReasonCache
()
klet
.
workQueue
=
queue
.
NewBasicWorkQueue
()
klet
.
workQueue
=
queue
.
NewBasicWorkQueue
()
klet
.
podWorkers
=
newPodWorkers
(
runtimeCache
,
klet
.
syncPod
,
recorder
,
klet
.
workQueue
,
klet
.
resyncInterval
,
backOffPeriod
,
klet
.
podCache
)
klet
.
podWorkers
=
newPodWorkers
(
runtimeCache
,
klet
.
syncPod
,
recorder
,
klet
.
workQueue
,
klet
.
resyncInterval
,
backOffPeriod
,
klet
.
podCache
)
...
@@ -563,6 +564,10 @@ type Kubelet struct {
...
@@ -563,6 +564,10 @@ type Kubelet struct {
// Container runtime.
// Container runtime.
containerRuntime
kubecontainer
.
Runtime
containerRuntime
kubecontainer
.
Runtime
// reasonCache caches the failure reason of the last creation of all containers, which is
// used for generating ContainerStatus.
reasonCache
*
ReasonCache
// nodeStatusUpdateFrequency specifies how often kubelet posts node status to master.
// nodeStatusUpdateFrequency specifies how often kubelet posts node status to master.
// Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod
// Note: be cautious when changing the constant, it must work with nodeMonitorGracePeriod
// in nodecontroller. There are several constraints:
// in nodecontroller. There are several constraints:
...
@@ -1676,8 +1681,8 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
...
@@ -1676,8 +1681,8 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont
}
}
result
:=
kl
.
containerRuntime
.
SyncPod
(
pod
,
apiPodStatus
,
podStatus
,
pullSecrets
,
kl
.
backOff
)
result
:=
kl
.
containerRuntime
.
SyncPod
(
pod
,
apiPodStatus
,
podStatus
,
pullSecrets
,
kl
.
backOff
)
err
=
result
.
Error
(
)
kl
.
reasonCache
.
Update
(
pod
.
UID
,
result
)
if
err
!=
nil
{
if
err
=
result
.
Error
();
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/kubelet/kubelet_test.go
View file @
e9dceb36
...
@@ -148,6 +148,7 @@ func newTestKubelet(t *testing.T) *TestKubelet {
...
@@ -148,6 +148,7 @@ func newTestKubelet(t *testing.T) *TestKubelet {
kubelet
.
containerRuntime
=
fakeRuntime
kubelet
.
containerRuntime
=
fakeRuntime
kubelet
.
runtimeCache
=
kubecontainer
.
NewFakeRuntimeCache
(
kubelet
.
containerRuntime
)
kubelet
.
runtimeCache
=
kubecontainer
.
NewFakeRuntimeCache
(
kubelet
.
containerRuntime
)
kubelet
.
reasonCache
=
NewReasonCache
()
kubelet
.
podWorkers
=
&
fakePodWorkers
{
kubelet
.
podWorkers
=
&
fakePodWorkers
{
syncPodFn
:
kubelet
.
syncPod
,
syncPodFn
:
kubelet
.
syncPod
,
runtimeCache
:
kubelet
.
runtimeCache
,
runtimeCache
:
kubelet
.
runtimeCache
,
...
...
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