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
d923e61d
Commit
d923e61d
authored
Sep 03, 2015
by
Abhi Shah
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13397 from yujuhong/housekeeping
kubelet: define the housekeeping period
parents
a1d5e843
13b268b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
14 deletions
+28
-14
kubelet.go
pkg/kubelet/kubelet.go
+28
-14
No files found.
pkg/kubelet/kubelet.go
View file @
d923e61d
...
@@ -91,6 +91,10 @@ const (
...
@@ -91,6 +91,10 @@ const (
// system default DNS resolver configuration
// system default DNS resolver configuration
ResolvConfDefault
=
"/etc/resolv.conf"
ResolvConfDefault
=
"/etc/resolv.conf"
// Minimum period for performing global cleanup tasks, i.e., housekeeping
// will not be performed more than once per housekeepingMinimumPeriod.
housekeepingMinimumPeriod
=
time
.
Second
*
2
)
)
var
(
var
(
...
@@ -1861,23 +1865,37 @@ func (kl *Kubelet) canAdmitPod(pods []*api.Pod, pod *api.Pod) (bool, string, str
...
@@ -1861,23 +1865,37 @@ func (kl *Kubelet) canAdmitPod(pods []*api.Pod, pod *api.Pod) (bool, string, str
// state every sync-frequency seconds. Never returns.
// state every sync-frequency seconds. Never returns.
func
(
kl
*
Kubelet
)
syncLoop
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
{
func
(
kl
*
Kubelet
)
syncLoop
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
{
glog
.
Info
(
"Starting kubelet main sync loop."
)
glog
.
Info
(
"Starting kubelet main sync loop."
)
var
housekeepingTimestamp
time
.
Time
for
{
for
{
if
!
kl
.
containerRuntimeUp
()
{
time
.
Sleep
(
5
*
time
.
Second
)
glog
.
Infof
(
"Skipping pod synchronization, container runtime is not up."
)
continue
}
if
!
kl
.
doneNetworkConfigure
()
{
time
.
Sleep
(
5
*
time
.
Second
)
glog
.
Infof
(
"Skipping pod synchronization, network is not configured"
)
continue
}
// We don't want to perform housekeeping too often, so we set a minimum
// period for it. Housekeeping would be performed at least once every
// kl.resyncInterval, and *no* more than once every
// housekeepingMinimumPeriod.
// TODO (#13418): Investigate whether we can/should spawn a dedicated
// goroutine for housekeeping
if
housekeepingTimestamp
.
IsZero
()
||
time
.
Since
(
housekeepingTimestamp
)
>
housekeepingMinimumPeriod
{
glog
.
V
(
4
)
.
Infof
(
"SyncLoop (housekeeping)"
)
if
err
:=
handler
.
HandlePodCleanups
();
err
!=
nil
{
glog
.
Errorf
(
"Failed cleaning pods: %v"
,
err
)
}
housekeepingTimestamp
=
time
.
Now
()
}
kl
.
syncLoopIteration
(
updates
,
handler
)
kl
.
syncLoopIteration
(
updates
,
handler
)
}
}
}
}
func
(
kl
*
Kubelet
)
syncLoopIteration
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
{
func
(
kl
*
Kubelet
)
syncLoopIteration
(
updates
<-
chan
PodUpdate
,
handler
SyncHandler
)
{
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
if
!
kl
.
containerRuntimeUp
()
{
time
.
Sleep
(
5
*
time
.
Second
)
glog
.
Infof
(
"Skipping pod synchronization, container runtime is not up."
)
return
}
if
!
kl
.
doneNetworkConfigure
()
{
time
.
Sleep
(
5
*
time
.
Second
)
glog
.
Infof
(
"Skipping pod synchronization, network is not configured"
)
return
}
select
{
select
{
case
u
,
ok
:=
<-
updates
:
case
u
,
ok
:=
<-
updates
:
if
!
ok
{
if
!
ok
{
...
@@ -1902,11 +1920,7 @@ func (kl *Kubelet) syncLoopIteration(updates <-chan PodUpdate, handler SyncHandl
...
@@ -1902,11 +1920,7 @@ func (kl *Kubelet) syncLoopIteration(updates <-chan PodUpdate, handler SyncHandl
// Periodically syncs all the pods and performs cleanup tasks.
// Periodically syncs all the pods and performs cleanup tasks.
glog
.
V
(
4
)
.
Infof
(
"SyncLoop (periodic sync)"
)
glog
.
V
(
4
)
.
Infof
(
"SyncLoop (periodic sync)"
)
handler
.
HandlePodSyncs
(
kl
.
podManager
.
GetPods
())
handler
.
HandlePodSyncs
(
kl
.
podManager
.
GetPods
())
if
err
:=
handler
.
HandlePodCleanups
();
err
!=
nil
{
glog
.
Errorf
(
"Failed cleaning pods: %v"
,
err
)
}
}
}
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
kl
.
syncLoopMonitor
.
Store
(
time
.
Now
())
}
}
...
...
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