Skip to content

Commit

Permalink
Reconciliation process with many images is slow #177
Browse files Browse the repository at this point in the history
  • Loading branch information
senthilrch committed Mar 10, 2023
1 parent 7f678b4 commit a89dbb9
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions cmd/controller/app/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}
}
}
Expand Down

0 comments on commit a89dbb9

Please sign in to comment.