From 908b82d11663b5aa41955b96dccb07085d119c5f Mon Sep 17 00:00:00 2001 From: Maxim Vasilenko Date: Fri, 20 Sep 2024 18:36:03 +0300 Subject: [PATCH] [mirror] Feature: Push parallelism support Signed-off-by: Maxim Vasilenko --- internal/mirror/cmd/push/push.go | 4 ++-- pkg/libmirror/layouts/push.go | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/mirror/cmd/push/push.go b/internal/mirror/cmd/push/push.go index 5193489..d2026c9 100644 --- a/internal/mirror/cmd/push/push.go +++ b/internal/mirror/cmd/push/push.go @@ -149,8 +149,8 @@ func buildPushContext() *contexts.PushContext { }, Parallelism: contexts.ParallelismConfig{ - Blobs: 4, - Images: 10, + Blobs: 2, + Images: 5, }, } return mirrorCtx diff --git a/pkg/libmirror/layouts/push.go b/pkg/libmirror/layouts/push.go index ec717cf..d3f9d39 100644 --- a/pkg/libmirror/layouts/push.go +++ b/pkg/libmirror/layouts/push.go @@ -69,7 +69,7 @@ func PushLayoutToRepo( batchesCount, imagesCount := 1, 1 for _, manifestSet := range batches { - if len(manifestSet) == 1 { + if parallelismConfig.Images == 1 { tag := manifestSet[0].Annotations["io.deckhouse.image.short_tag"] imageRef := registryRepo + ":" + tag logger.InfoF("[%d / %d] Pushing image %s", imagesCount, len(indexManifest.Manifests), imageRef) @@ -81,9 +81,7 @@ func PushLayoutToRepo( err = logger.Process(fmt.Sprintf("Pushing batch %d / %d", batchesCount, len(batches)), func() error { logger.InfoLn("Images in batch:") for _, manifest := range manifestSet { - tag := manifest.Annotations["io.deckhouse.image.short_tag"] - imageRef := registryRepo + ":" + tag - logger.InfoF("- %s", imageRef) + logger.InfoF("- %s", registryRepo+":"+manifest.Annotations["io.deckhouse.image.short_tag"]) } parallel.ForEach(manifestSet, pushImage(logger, registryRepo, index, imagesCount, refOpts, remoteOpts))