Check pod HasSynced in deployment controller manager

This commit is contained in:
Janet Kuo 2016-02-11 11:31:47 -08:00
parent b5c12d10b8
commit 2731e5fe20

View File

@ -52,9 +52,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 replica set until the replica set store has synced. If it hasn't synced, to // We must avoid creating new replica set / counting pods until the replica set / pods store has synced.
// avoid a hot loop, we'll wait this long between checks. // If it hasn't synced, to avoid a hot loop, we'll wait this long between checks.
RSStoreSyncedPollPeriod = 100 * time.Millisecond StoreSyncedPollPeriod = 100 * time.Millisecond
) )
// DeploymentController is responsible for synchronizing Deployment objects stored // DeploymentController is responsible for synchronizing Deployment objects stored
@ -410,10 +410,10 @@ func (dc *DeploymentController) syncDeployment(key string) error {
return nil return nil
} }
d := *obj.(*extensions.Deployment) d := *obj.(*extensions.Deployment)
if !dc.rsStoreSynced() { if !dc.rsStoreSynced() || !dc.podStoreSynced() {
// Sleep so we give the replica set reflector goroutine a chance to run. // Sleep so we give the replica set / pod reflector goroutine a chance to run.
time.Sleep(RSStoreSyncedPollPeriod) time.Sleep(StoreSyncedPollPeriod)
glog.Infof("Waiting for replica set controller to sync, requeuing deployment %s", d.Name) glog.Infof("Waiting for replica set / pod controller to sync, requeuing deployment %s", d.Name)
dc.enqueueDeployment(&d) dc.enqueueDeployment(&d)
return nil return nil
} }