Fix sending an empty update when the source is ready

pull/6/head
Yu-Ju Hong 2016-01-21 10:59:11 -08:00
parent 233d292ae5
commit 0fada52788
1 changed files with 7 additions and 1 deletions

View File

@ -161,12 +161,18 @@ func (s *podStorage) Merge(source string, change interface{}) error {
if len(deletes.Pods) > 0 {
s.updates <- *deletes
}
if len(adds.Pods) > 0 || firstSet {
if len(adds.Pods) > 0 {
s.updates <- *adds
}
if len(updates.Pods) > 0 {
s.updates <- *updates
}
if firstSet && len(adds.Pods) == 0 && len(updates.Pods) == 0 {
// Send an empty update when first seeing the source and there are
// no ADD or UPDATE pods from the source. This signals kubelet that
// the source is ready.
s.updates <- *adds
}
// Only add reconcile support here, because kubelet doesn't support Snapshot update now.
if len(reconciles.Pods) > 0 {
s.updates <- *reconciles