diff --git a/cmd/controller/app/controller.go b/cmd/controller/app/controller.go index fc3a633d..b8f5a2d5 100644 --- a/cmd/controller/app/controller.go +++ b/cmd/controller/app/controller.go @@ -525,16 +525,18 @@ func (c *Controller) syncHandler(wqKey images.WorkQueueKey) error { glog.V(4).Infof("No. of nodes in %+v is %d", i.NodeSelector, len(nodes)) for _, n := range nodes { - for m := range i.Images { - ipr := images.ImageWorkRequest{ - Image: i.Images[m], - Node: n, - ContainerRuntimeVersion: n.Status.NodeInfo.ContainerRuntimeVersion, - WorkType: wqKey.WorkType, - Imagecache: imageCache, + /* + for m := range i.Images { + ipr := images.ImageWorkRequest{ + Image: i.Images[m], + Node: n, + ContainerRuntimeVersion: n.Status.NodeInfo.ContainerRuntimeVersion, + WorkType: wqKey.WorkType, + Imagecache: imageCache, + } + c.imageworkqueue.AddRateLimited(ipr) } - c.imageworkqueue.AddRateLimited(ipr) - } + */ if wqKey.WorkType == images.ImageCacheUpdate { for _, oldimage := range wqKey.OldImageCache.Spec.CacheSpec[k].Images { matched := false @@ -555,6 +557,25 @@ func (c *Controller) syncHandler(wqKey images.WorkQueueKey) error { c.imageworkqueue.AddRateLimited(ipr) } } + for _, newimage := range i.Images { + matched := false + for _, oldimage := range wqKey.OldImageCache.Spec.CacheSpec[k].Images { + if oldimage == newimage { + matched = true + break + } + } + if !matched { + ipr := images.ImageWorkRequest{ + Image: newimage, + Node: n, + ContainerRuntimeVersion: n.Status.NodeInfo.ContainerRuntimeVersion, + WorkType: images.ImageCacheUpdate, + Imagecache: imageCache, + } + c.imageworkqueue.AddRateLimited(ipr) + } + } } } }