kubelet: remove background updating thread in RuntimeCache

This feature is no longer useful pods don't sync as often. For batch
creation/deletions/syncs, the cache will be up-to-date for most pods since it
will be updated frequently. For other cases, continue updating for two more
seconds don't usually help, as temporal locality doesn't hold across pod syncs.
This commit is contained in:
Yu-Ju Hong
2015-11-19 16:26:49 -08:00
parent b12550273e
commit dc42d25f4a
2 changed files with 3 additions and 76 deletions

View File

@@ -86,27 +86,3 @@ func TestForceUpdateIfOlder(t *testing.T) {
t.Errorf("expected %#v, got %#v", newpods, actual)
}
}
func TestUpdatePodsOnlyIfNewer(t *testing.T) {
runtime := &FakeRuntime{}
cache := newTestRuntimeCache(runtime)
// Cache new pods with a future timestamp.
newpods := []*Pod{{ID: "1111"}, {ID: "2222"}, {ID: "3333"}}
cache.Lock()
cache.pods = newpods
cache.cacheTime = time.Now().Add(20 * time.Minute)
cache.Unlock()
// Instruct runime to return a list of old pods.
oldpods := []*Pod{{ID: "1111"}}
runtime.PodList = oldpods
// Try to update the cache; the attempt should not succeed because the
// cache timestamp is newer than the current time.
cache.updateCacheWithLock()
actual := cache.getCachedPods()
if !reflect.DeepEqual(newpods, actual) {
t.Errorf("expected %#v, got %#v", newpods, actual)
}
}