Skip to content

Commit

Permalink
deploy: drop unnecessary resource handlers to reduce dc requeues
Browse files Browse the repository at this point in the history
No reason to enqueue deployment configs on rc ADDs since there is no
new info deployment configs don't know at that point (adoption is not
possible). No reason to enqueue on pod ADDs since the only reasons we
need pod notification are 1) to bring back DELETEd pods and 2) to
update the deployment config status with AvailableReplicas once a pod
is UPDATEd to Ready/Available.
  • Loading branch information
0xmichalis committed Nov 29, 2016
1 parent 5250b95 commit 5109853
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions pkg/deploy/controller/deploymentconfig/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ func NewDeploymentConfigController(dcInformer, rcInformer, podInformer framework
})
c.rcStore.Indexer = rcInformer.GetIndexer()
rcInformer.AddEventHandler(framework.ResourceEventHandlerFuncs{
AddFunc: c.addReplicationController,
UpdateFunc: c.updateReplicationController,
DeleteFunc: c.deleteReplicationController,
})
c.podStore.Indexer = podInformer.GetIndexer()
podInformer.AddEventHandler(framework.ResourceEventHandlerFuncs{
AddFunc: c.addPod,
UpdateFunc: c.updatePod,
DeleteFunc: c.deletePod,
})
Expand Down Expand Up @@ -144,20 +142,6 @@ func (c *DeploymentConfigController) deleteDeploymentConfig(obj interface{}) {
c.enqueueDeploymentConfig(dc)
}

// addReplicationController figures out which deploymentconfig is managing this replication
// controller and requeues the deployment config.
// TODO: Determine if we need to resync here. Would be useful for adoption but we cannot
// adopt right now.
func (c *DeploymentConfigController) addReplicationController(obj interface{}) {
rc := obj.(*kapi.ReplicationController)
glog.V(4).Infof("Replication controller %q added.", rc.Name)
// We are waiting for the deployment config store to sync but still there are pathological
// cases of highly latent watches.
if dc, err := c.dcStore.GetConfigForController(rc); err == nil && dc != nil {
c.enqueueDeploymentConfig(dc)
}
}

// updateReplicationController figures out which deploymentconfig is managing this replication
// controller and requeues the deployment config.
func (c *DeploymentConfigController) updateReplicationController(old, cur interface{}) {
Expand Down Expand Up @@ -201,12 +185,6 @@ func (c *DeploymentConfigController) deleteReplicationController(obj interface{}
}
}

func (c *DeploymentConfigController) addPod(obj interface{}) {
if dc, err := c.dcStore.GetConfigForPod(obj.(*kapi.Pod)); err == nil && dc != nil {
c.enqueueDeploymentConfig(dc)
}
}

func (c *DeploymentConfigController) updatePod(old, cur interface{}) {
curPod := cur.(*kapi.Pod)
oldPod := old.(*kapi.Pod)
Expand Down

0 comments on commit 5109853

Please sign in to comment.