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
57c40917
Commit
57c40917
authored
Jan 07, 2016
by
Jeff Lowdermilk
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19344 from janetkuo/flake-deployment
Wait for rc store synced before syncing deployment
parents
791cae90
c782aaa5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
deployment_controller.go
pkg/controller/deployment/deployment_controller.go
+23
-2
No files found.
pkg/controller/deployment/deployment_controller.go
View file @
57c40917
...
@@ -43,6 +43,9 @@ const (
...
@@ -43,6 +43,9 @@ const (
// of all deployments that have fulfilled their expectations at least this often.
// of all deployments that have fulfilled their expectations at least this often.
// This recomputation happens based on contents in the local caches.
// This recomputation happens based on contents in the local caches.
FullDeploymentResyncPeriod
=
30
*
time
.
Second
FullDeploymentResyncPeriod
=
30
*
time
.
Second
// We must avoid creating new rc until the rc store has synced. If it hasn't synced, to
// avoid a hot loop, we'll wait this long between checks.
RcStoreSyncedPollPeriod
=
100
*
time
.
Millisecond
)
)
// DeploymentController is responsible for synchronizing Deployment objects stored
// DeploymentController is responsible for synchronizing Deployment objects stored
...
@@ -107,13 +110,23 @@ func NewDeploymentController(client client.Interface, resyncPeriod controller.Re
...
@@ -107,13 +110,23 @@ func NewDeploymentController(client client.Interface, resyncPeriod controller.Re
&
extensions
.
Deployment
{},
&
extensions
.
Deployment
{},
FullDeploymentResyncPeriod
,
FullDeploymentResyncPeriod
,
framework
.
ResourceEventHandlerFuncs
{
framework
.
ResourceEventHandlerFuncs
{
AddFunc
:
dc
.
enqueueDeployment
,
AddFunc
:
func
(
obj
interface
{})
{
d
:=
obj
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Adding deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
obj
)
},
UpdateFunc
:
func
(
old
,
cur
interface
{})
{
UpdateFunc
:
func
(
old
,
cur
interface
{})
{
oldD
:=
old
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Updating deployment %s"
,
oldD
.
Name
)
// Resync on deployment object relist.
// Resync on deployment object relist.
dc
.
enqueueDeployment
(
cur
)
dc
.
enqueueDeployment
(
cur
)
},
},
// This will enter the sync loop and no-op, because the deployment has been deleted from the store.
// This will enter the sync loop and no-op, because the deployment has been deleted from the store.
DeleteFunc
:
dc
.
enqueueDeployment
,
DeleteFunc
:
func
(
obj
interface
{})
{
d
:=
obj
.
(
*
extensions
.
Deployment
)
glog
.
V
(
4
)
.
Infof
(
"Deleting deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
obj
)
},
},
},
)
)
...
@@ -375,6 +388,14 @@ func (dc *DeploymentController) syncDeployment(key string) error {
...
@@ -375,6 +388,14 @@ func (dc *DeploymentController) syncDeployment(key string) error {
return
nil
return
nil
}
}
d
:=
*
obj
.
(
*
extensions
.
Deployment
)
d
:=
*
obj
.
(
*
extensions
.
Deployment
)
if
!
dc
.
rcStoreSynced
()
{
// Sleep so we give the rc reflector goroutine a chance to run.
time
.
Sleep
(
RcStoreSyncedPollPeriod
)
glog
.
Infof
(
"Waiting for rc controller to sync, requeuing deployment %s"
,
d
.
Name
)
dc
.
enqueueDeployment
(
d
)
return
nil
}
switch
d
.
Spec
.
Strategy
.
Type
{
switch
d
.
Spec
.
Strategy
.
Type
{
case
extensions
.
RecreateDeploymentStrategyType
:
case
extensions
.
RecreateDeploymentStrategyType
:
return
dc
.
syncRecreateDeployment
(
d
)
return
dc
.
syncRecreateDeployment
(
d
)
...
...
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