Commit Graph

4 Commits (09f00aeb32e9b11dfaee356ba58d035d0b7e1a3c)

Author SHA1 Message Date
Tim St. Clair 7b6d843309 Move test-only files to test-only packages 2016-03-01 09:11:32 -08:00
Yu-Ju Hong dc42d25f4a 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.
2015-11-19 17:25:51 -08:00
Yu-Ju Hong 9a71fb9373 Kubelet: clean up kubelet_test.go
* Start using FakeRuntime to replace FakeDockerClient in unit tests.
 * Move and adapt docker-specific tests (e.g. creating/deleting infra
   containers) to manager_test.go in dockertools.
2015-05-26 17:11:24 -07:00
Yu-Ju Hong c075719f05 Kubelet: fix the runtime cache to not cache the stale pods
If a pod worker sees stale pods from the runtime cache which were retrieved
before their last sync finished, it may think that the pod were not started
correctly, and attemp to fix that by killing/restarting containers.
There are two issues that may cause runtime cache to store stale pods:
  1. The timstamp is recorded *after* getting the pods from the container
     runtime. This may lead the consumer to think the pods are newer than they
     actually are.
  2. The cache updates are triggered by many goroutines (pod workers, and the
     updating thread). There is no mechanism to enforece that the cache would
     only be updated to newer pods.

This change fixes the above two issues by making sure one always record the
timestamp before getting pods from the container runtime, and updates the
cached pods only if the timestamp is newer.
2015-05-05 18:28:38 -07:00