From 9af84a7d95f74798179af4d97aedce7d6ee3bd89 Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 15 Apr 2021 10:40:43 -0700 Subject: [PATCH] debug options --- Makefile | 2 +- hack/preload-images/preload_images.go | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d25a4f1efa..ad34198cb9 100644 --- a/Makefile +++ b/Makefile @@ -693,7 +693,7 @@ upload-preloaded-images-tar: out/minikube out/upload-preload # Upload the preloa .PHONY: generate-preloaded-images-tar generate-preloaded-images-tar: out/minikube out/upload-preload # Upload the preloaded images for oldest supported, newest supported, and default kubernetes versions to GCS. - ./out/upload-preload --no-upload --force + ./out/upload-preload --no-upload --force --limit 5 ALL_ARCH = amd64 arm arm64 ppc64le s390x IMAGE = $(REGISTRY)/storage-provisioner diff --git a/hack/preload-images/preload_images.go b/hack/preload-images/preload_images.go index 28c843828e..df7d619d72 100644 --- a/hack/preload-images/preload_images.go +++ b/hack/preload-images/preload_images.go @@ -46,6 +46,7 @@ var ( k8sVersion = flag.String("kubernetes-version", "", "desired Kubernetes version, for example `v1.17.2`") noUpload = flag.Bool("no-upload", false, "Do not upload tarballs to GCS") force = flag.Bool("force", false, "Generate the preload tarball even if it's already exists") + limit = flag.Int("limit", 0, "Limit the number of tarballs to generate") ) type preloadCfg struct { @@ -73,10 +74,17 @@ func main() { if err != nil { exit("Unable to get recent k8s versions: %v\n", err) } - var toGenerate []preloadCfg + var toGenerate []preloadCfg + var i int + + out: for _, kv := range k8sVersions { for _, cr := range containerRuntimes { + if *limit > 0 && i >= *limit { + break out + } + i++ if *force || !download.PreloadExists(kv, cr) { toGenerate = append(toGenerate, preloadCfg{kv, cr}) fmt.Printf("A preloaded tarball for k8s version %s - runtime %q already exists, skipping generation.\n", kv, cr)