Skip to content

Commit

Permalink
Remove ttl store from controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
bprashanth committed Feb 24, 2016
1 parent 45eb835 commit 7e88b3e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
18 changes: 2 additions & 16 deletions pkg/controller/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,7 @@ import (
"k8s.io/kubernetes/pkg/runtime"
)

const (
CreatedByAnnotation = "kubernetes.io/created-by"

// If a watch drops a delete event for a pod, it'll take this long
// before a dormant controller waiting for those packets is woken up anyway. It is
// specifically targeted at the case where some problem prevents an update
// of expectations, without it the controller could stay asleep forever. This should
// be set based on the expected latency of watch events.
//
// Currently a controller can service (create *and* observe the watch events for said
// creation) about 10-20 pods a second, so it takes about 1 min to service
// 500 pods. Just creation is limited to 20qps, and watching happens with ~10-30s
// latency/pod at the scale of 3000 pods over 100 nodes.
ExpectationsTimeout = 3 * time.Minute
)
const CreatedByAnnotation = "kubernetes.io/created-by"

var (
KeyFunc = framework.DeletionHandlingMetaNamespaceKeyFunc
Expand Down Expand Up @@ -221,7 +207,7 @@ func (e *ControlleeExpectations) GetExpectations() (int64, int64) {

// NewControllerExpectations returns a store for ControlleeExpectations.
func NewControllerExpectations() *ControllerExpectations {
return &ControllerExpectations{cache.NewTTLStore(ExpKeyFunc, ExpectationsTimeout)}
return &ControllerExpectations{cache.NewStore(ExpKeyFunc)}
}

// PodControlInterface is an interface that knows how to add or delete pods
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/deployment/deployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,12 @@ func (dc *DeploymentController) deletePod(obj interface{}) {
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
glog.Errorf("Couldn't get object from tombstone %+v, could take up to %v before a ReplicaSet recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Couldn't get object from tombstone %+v", obj)
return
}
pod, ok = tombstone.Obj.(*api.Pod)
if !ok {
glog.Errorf("Tombstone contained object that is not a pod %+v, could take up to %v before ReplicaSet recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Tombstone contained object that is not a pod %+v", obj)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/job/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ func (jm *JobController) deletePod(obj interface{}) {
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
glog.Errorf("Couldn't get object from tombstone %+v, could take up to %v before a job recreates a pod", obj, controller.ExpectationsTimeout)
glog.Errorf("Couldn't get object from tombstone %+v", obj)
return
}
pod, ok = tombstone.Obj.(*api.Pod)
if !ok {
glog.Errorf("Tombstone contained object that is not a pod %+v, could take up to %v before job recreates a pod", obj, controller.ExpectationsTimeout)
glog.Errorf("Tombstone contained object that is not a pod %+v", obj)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/replicaset/replica_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ func (rsc *ReplicaSetController) deletePod(obj interface{}) {
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
glog.Errorf("Couldn't get object from tombstone %+v, could take up to %v before a replica set recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Couldn't get object from tombstone %+v", obj)
return
}
pod, ok = tombstone.Obj.(*api.Pod)
if !ok {
glog.Errorf("Tombstone contained object that is not a pod %+v, could take up to %v before replica set recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Tombstone contained object that is not a pod %+v", obj)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/replication/replication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ func (rm *ReplicationManager) deletePod(obj interface{}) {
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
glog.Errorf("Couldn't get object from tombstone %+v, could take up to %v before a controller recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Couldn't get object from tombstone %+v", obj)
return
}
pod, ok = tombstone.Obj.(*api.Pod)
if !ok {
glog.Errorf("Tombstone contained object that is not a pod %+v, could take up to %v before controller recreates a replica", obj, controller.ExpectationsTimeout)
glog.Errorf("Tombstone contained object that is not a pod %+v", obj)
return
}
}
Expand Down

0 comments on commit 7e88b3e

Please sign in to comment.