mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user