mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
kubelet: mark source ready after updating the cache
This ensures that cleanup routines don't start until the cache content is up-to-date.
This commit is contained in:
parent
cdfd46cc15
commit
8e48221c24
@ -2175,7 +2175,6 @@ func (kl *Kubelet) syncLoopIteration(configCh <-chan kubetypes.PodUpdate, handle
|
|||||||
glog.Errorf("Update channel is closed. Exiting the sync loop.")
|
glog.Errorf("Update channel is closed. Exiting the sync loop.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
kl.sourcesReady.AddSource(u.Source)
|
|
||||||
|
|
||||||
switch u.Op {
|
switch u.Op {
|
||||||
case kubetypes.ADD:
|
case kubetypes.ADD:
|
||||||
@ -2202,6 +2201,14 @@ func (kl *Kubelet) syncLoopIteration(configCh <-chan kubetypes.PodUpdate, handle
|
|||||||
// TODO: Do we want to support this?
|
// TODO: Do we want to support this?
|
||||||
glog.Errorf("Kubelet does not support snapshot update")
|
glog.Errorf("Kubelet does not support snapshot update")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark the source ready after receiving at least one update from the
|
||||||
|
// source. Once all the sources are marked ready, various cleanup
|
||||||
|
// routines will start reclaiming resources. It is important that this
|
||||||
|
// takes place only after kubelet calls the update handler to process
|
||||||
|
// the update to ensure the internal pod cache is up-to-date.
|
||||||
|
kl.sourcesReady.AddSource(u.Source)
|
||||||
|
|
||||||
case e := <-plegCh:
|
case e := <-plegCh:
|
||||||
if isSyncPodWorthy(e) {
|
if isSyncPodWorthy(e) {
|
||||||
// PLEG event for a pod; sync it.
|
// PLEG event for a pod; sync it.
|
||||||
|
Loading…
Reference in New Issue
Block a user