Delete expectations of a deleted rc instead of letting them expire
This commit is contained in:
@@ -63,6 +63,7 @@ var expKeyFunc = func(obj interface{}) (string, error) {
|
||||
type RCExpectationsManager interface {
|
||||
GetExpectations(rc *api.ReplicationController) (*PodExpectations, bool, error)
|
||||
SatisfiedExpectations(rc *api.ReplicationController) bool
|
||||
DeleteExpectations(rcKey string)
|
||||
ExpectCreations(rc *api.ReplicationController, adds int) error
|
||||
ExpectDeletions(rc *api.ReplicationController, dels int) error
|
||||
CreationObserved(rc *api.ReplicationController)
|
||||
@@ -87,6 +88,15 @@ func (r *RCExpectations) GetExpectations(rc *api.ReplicationController) (*PodExp
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteExpectations deletes the expectations of the given RC from the TTLStore.
|
||||
func (r *RCExpectations) DeleteExpectations(rcKey string) {
|
||||
if podExp, exists, err := r.GetByKey(rcKey); err == nil && exists {
|
||||
if err := r.Delete(podExp); err != nil {
|
||||
glog.V(2).Infof("Error deleting expectations for rc %v: %v", rcKey, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SatisfiedExpectations returns true if the replication manager has observed the required adds/dels
|
||||
// for the given rc. Add/del counts are established by the rc at sync time, and updated as pods
|
||||
// are observed by the replication manager's podController.
|
||||
|
Reference in New Issue
Block a user