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
ced5eb7a
Commit
ced5eb7a
authored
Feb 13, 2016
by
mqliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return early if has not synced
parent
78c294a6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
35 deletions
+41
-35
controller.go
pkg/controller/daemon/controller.go
+9
-7
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+8
-7
controller.go
pkg/controller/job/controller.go
+8
-7
replica_set.go
pkg/controller/replicaset/replica_set.go
+8
-7
replication_controller.go
pkg/controller/replication/replication_controller.go
+8
-7
No files found.
pkg/controller/daemon/controller.go
View file @
ced5eb7a
...
@@ -535,6 +535,15 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
...
@@ -535,6 +535,15 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
defer
func
()
{
defer
func
()
{
glog
.
V
(
4
)
.
Infof
(
"Finished syncing daemon set %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing daemon set %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
}()
}()
if
!
dsc
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing ds %v"
,
key
)
dsc
.
queue
.
Add
(
key
)
return
nil
}
obj
,
exists
,
err
:=
dsc
.
dsStore
.
Store
.
GetByKey
(
key
)
obj
,
exists
,
err
:=
dsc
.
dsStore
.
Store
.
GetByKey
(
key
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Infof
(
"Unable to retrieve ds %v from store: %v"
,
key
,
err
)
glog
.
Infof
(
"Unable to retrieve ds %v from store: %v"
,
key
,
err
)
...
@@ -547,13 +556,6 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
...
@@ -547,13 +556,6 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
return
nil
return
nil
}
}
ds
:=
obj
.
(
*
extensions
.
DaemonSet
)
ds
:=
obj
.
(
*
extensions
.
DaemonSet
)
if
!
dsc
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing ds %v"
,
ds
.
Name
)
dsc
.
enqueueDaemonSet
(
ds
)
return
nil
}
// Don't process a daemon set until all its creations and deletions have been processed.
// Don't process a daemon set until all its creations and deletions have been processed.
// For example if daemon set foo asked for 3 new daemon pods in the previous call to manage,
// For example if daemon set foo asked for 3 new daemon pods in the previous call to manage,
...
...
pkg/controller/deployment/deployment_controller.go
View file @
ced5eb7a
...
@@ -397,6 +397,14 @@ func (dc *DeploymentController) syncDeployment(key string) error {
...
@@ -397,6 +397,14 @@ func (dc *DeploymentController) syncDeployment(key string) error {
glog
.
V
(
4
)
.
Infof
(
"Finished syncing deployment %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing deployment %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
}()
}()
if
!
dc
.
rsStoreSynced
()
||
!
dc
.
podStoreSynced
()
{
// Sleep so we give the replica set / pod reflector goroutine a chance to run.
time
.
Sleep
(
StoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for replica set / pod controller to sync, requeuing deployment %s"
,
key
)
dc
.
queue
.
Add
(
key
)
return
nil
}
obj
,
exists
,
err
:=
dc
.
dStore
.
Store
.
GetByKey
(
key
)
obj
,
exists
,
err
:=
dc
.
dStore
.
Store
.
GetByKey
(
key
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Infof
(
"Unable to retrieve deployment %v from store: %v"
,
key
,
err
)
glog
.
Infof
(
"Unable to retrieve deployment %v from store: %v"
,
key
,
err
)
...
@@ -410,13 +418,6 @@ func (dc *DeploymentController) syncDeployment(key string) error {
...
@@ -410,13 +418,6 @@ func (dc *DeploymentController) syncDeployment(key string) error {
return
nil
return
nil
}
}
d
:=
*
obj
.
(
*
extensions
.
Deployment
)
d
:=
*
obj
.
(
*
extensions
.
Deployment
)
if
!
dc
.
rsStoreSynced
()
||
!
dc
.
podStoreSynced
()
{
// Sleep so we give the replica set / pod reflector goroutine a chance to run.
time
.
Sleep
(
StoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for replica set / pod controller to sync, requeuing deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
&
d
)
return
nil
}
if
d
.
Spec
.
Paused
{
if
d
.
Spec
.
Paused
{
// Ignore paused deployments
// Ignore paused deployments
...
...
pkg/controller/job/controller.go
View file @
ced5eb7a
...
@@ -288,6 +288,14 @@ func (jm *JobController) syncJob(key string) error {
...
@@ -288,6 +288,14 @@ func (jm *JobController) syncJob(key string) error {
glog
.
V
(
4
)
.
Infof
(
"Finished syncing job %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing job %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
}()
}()
if
!
jm
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
replicationcontroller
.
PodStoreSyncedPollPeriod
)
glog
.
V
(
4
)
.
Infof
(
"Waiting for pods controller to sync, requeuing job %v"
,
key
)
jm
.
queue
.
Add
(
key
)
return
nil
}
obj
,
exists
,
err
:=
jm
.
jobStore
.
Store
.
GetByKey
(
key
)
obj
,
exists
,
err
:=
jm
.
jobStore
.
Store
.
GetByKey
(
key
)
if
!
exists
{
if
!
exists
{
glog
.
V
(
4
)
.
Infof
(
"Job has been deleted: %v"
,
key
)
glog
.
V
(
4
)
.
Infof
(
"Job has been deleted: %v"
,
key
)
...
@@ -300,13 +308,6 @@ func (jm *JobController) syncJob(key string) error {
...
@@ -300,13 +308,6 @@ func (jm *JobController) syncJob(key string) error {
return
err
return
err
}
}
job
:=
*
obj
.
(
*
extensions
.
Job
)
job
:=
*
obj
.
(
*
extensions
.
Job
)
if
!
jm
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
replicationcontroller
.
PodStoreSyncedPollPeriod
)
glog
.
V
(
4
)
.
Infof
(
"Waiting for pods controller to sync, requeuing job %v"
,
job
.
Name
)
jm
.
enqueueController
(
&
job
)
return
nil
}
// Check the expectations of the job before counting active pods, otherwise a new pod can sneak in
// Check the expectations of the job before counting active pods, otherwise a new pod can sneak in
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
...
...
pkg/controller/replicaset/replica_set.go
View file @
ced5eb7a
...
@@ -407,6 +407,14 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
...
@@ -407,6 +407,14 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
glog
.
V
(
4
)
.
Infof
(
"Finished syncing replica set %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing replica set %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
}()
}()
if
!
rsc
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing ReplicaSet %v"
,
key
)
rsc
.
queue
.
Add
(
key
)
return
nil
}
obj
,
exists
,
err
:=
rsc
.
rsStore
.
Store
.
GetByKey
(
key
)
obj
,
exists
,
err
:=
rsc
.
rsStore
.
Store
.
GetByKey
(
key
)
if
!
exists
{
if
!
exists
{
glog
.
Infof
(
"ReplicaSet has been deleted %v"
,
key
)
glog
.
Infof
(
"ReplicaSet has been deleted %v"
,
key
)
...
@@ -419,13 +427,6 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
...
@@ -419,13 +427,6 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
return
err
return
err
}
}
rs
:=
*
obj
.
(
*
extensions
.
ReplicaSet
)
rs
:=
*
obj
.
(
*
extensions
.
ReplicaSet
)
if
!
rsc
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing ReplicaSet %v"
,
rs
.
Name
)
rsc
.
enqueueReplicaSet
(
&
rs
)
return
nil
}
// Check the expectations of the ReplicaSet before counting active pods, otherwise a new pod can sneak
// Check the expectations of the ReplicaSet before counting active pods, otherwise a new pod can sneak
// in and update the expectations after we've retrieved active pods from the store. If a new pod enters
// in and update the expectations after we've retrieved active pods from the store. If a new pod enters
...
...
pkg/controller/replication/replication_controller.go
View file @
ced5eb7a
...
@@ -409,6 +409,14 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
...
@@ -409,6 +409,14 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
glog
.
V
(
4
)
.
Infof
(
"Finished syncing controller %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing controller %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
}()
}()
if
!
rm
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing rc %v"
,
key
)
rm
.
queue
.
Add
(
key
)
return
nil
}
obj
,
exists
,
err
:=
rm
.
rcStore
.
Store
.
GetByKey
(
key
)
obj
,
exists
,
err
:=
rm
.
rcStore
.
Store
.
GetByKey
(
key
)
if
!
exists
{
if
!
exists
{
glog
.
Infof
(
"Replication Controller has been deleted %v"
,
key
)
glog
.
Infof
(
"Replication Controller has been deleted %v"
,
key
)
...
@@ -421,13 +429,6 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
...
@@ -421,13 +429,6 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
return
err
return
err
}
}
rc
:=
*
obj
.
(
*
api
.
ReplicationController
)
rc
:=
*
obj
.
(
*
api
.
ReplicationController
)
if
!
rm
.
podStoreSynced
()
{
// Sleep so we give the pod reflector goroutine a chance to run.
time
.
Sleep
(
PodStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for pods controller to sync, requeuing rc %v"
,
rc
.
Name
)
rm
.
enqueueController
(
&
rc
)
return
nil
}
// Check the expectations of the rc before counting active pods, otherwise a new pod can sneak in
// Check the expectations of the rc before counting active pods, otherwise a new pod can sneak in
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
// and update the expectations after we've retrieved active pods from the store. If a new pod enters
...
...
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