From df19871c8c8e9ab32d605815c5dc302468380342 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Mon, 13 Apr 2026 17:39:06 +0300 Subject: [PATCH 1/4] feat(vm): support live change of cpu fractions ++ occupy PR for feature, use it for dvcr testing for now Signed-off-by: Ivan Mikheykin --- images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go index b827981abb..5b4b08292c 100644 --- a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go +++ b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go @@ -189,6 +189,14 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error { errs = multierror.Append(errs, secretErr) } + // Testing: sleep and print errors if present. + time.Sleep(time.Second * 30) + err = errs.ErrorOrNil() + if err != nil { + fmt.Printf("Error while cleaning up stale images after cleanup: %v\n", err) + } + // Testing end. + // Return previous errors, so Pod will be restarted without waiting. err = errs.ErrorOrNil() if err != nil { From dbbee470f05781a681dcc46c270dd914c338d44d Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Mon, 13 Apr 2026 18:38:24 +0300 Subject: [PATCH 2/4] ++ delay before "cleanup done" Signed-off-by: Ivan Mikheykin --- images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go index 5b4b08292c..f19925bea3 100644 --- a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go +++ b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go @@ -183,12 +183,6 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error { return errs.ErrorOrNil() } - // Update garbage collection secret and wait for termination signal. - secretErr := annotateGarbageCollectionSecretOnCleanupDone(context.Background(), result) - if secretErr != nil { - errs = multierror.Append(errs, secretErr) - } - // Testing: sleep and print errors if present. time.Sleep(time.Second * 30) err = errs.ErrorOrNil() @@ -197,6 +191,12 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error { } // Testing end. + // Update garbage collection secret and wait for termination signal. + secretErr := annotateGarbageCollectionSecretOnCleanupDone(context.Background(), result) + if secretErr != nil { + errs = multierror.Append(errs, secretErr) + } + // Return previous errors, so Pod will be restarted without waiting. err = errs.ErrorOrNil() if err != nil { From 2e20c96543b1bc72d1b8faf95d6676448368f519 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Mon, 13 Apr 2026 21:17:38 +0300 Subject: [PATCH 3/4] ++ sleep before secret annotation Signed-off-by: Ivan Mikheykin --- images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go index f19925bea3..4e62233214 100644 --- a/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go +++ b/images/dvcr-artifact/cmd/dvcr-cleaner/cmd/gc.go @@ -146,6 +146,14 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error { errs = multierror.Append(errs, cleanupErr) } + // Testing: sleep and print errors if present. + time.Sleep(time.Second * 30) + err = errs.ErrorOrNil() + if err != nil { + fmt.Printf("Error while cleaning up stale images after cleanup: %v\n", err) + } + // Testing end. + result := map[string]any{ "result": "success", "startedAt": started, @@ -183,14 +191,6 @@ func autoCleanupHandler(cmd *cobra.Command, args []string) error { return errs.ErrorOrNil() } - // Testing: sleep and print errors if present. - time.Sleep(time.Second * 30) - err = errs.ErrorOrNil() - if err != nil { - fmt.Printf("Error while cleaning up stale images after cleanup: %v\n", err) - } - // Testing end. - // Update garbage collection secret and wait for termination signal. secretErr := annotateGarbageCollectionSecretOnCleanupDone(context.Background(), result) if secretErr != nil { From 79071ef8fb6b65610ded7577cf2b5e6689400ac4 Mon Sep 17 00:00:00 2001 From: Ivan Mikheykin Date: Tue, 14 Apr 2026 16:29:44 +0300 Subject: [PATCH 4/4] ++ add delay for testing Signed-off-by: Ivan Mikheykin --- .../dvcr-garbage-collection/internal/life_cycle.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/images/virtualization-artifact/pkg/controller/dvcr-garbage-collection/internal/life_cycle.go b/images/virtualization-artifact/pkg/controller/dvcr-garbage-collection/internal/life_cycle.go index 6f5a428616..00295f00c3 100644 --- a/images/virtualization-artifact/pkg/controller/dvcr-garbage-collection/internal/life_cycle.go +++ b/images/virtualization-artifact/pkg/controller/dvcr-garbage-collection/internal/life_cycle.go @@ -88,7 +88,10 @@ func (h LifeCycleHandler) Handle(ctx context.Context, req reconcile.Request, dep // Put full result JSON into annotation on deployment. annotations.AddAnnotation(deploy, annotations.AnnDVCRGarbageCollectionResult, h.dvcrService.GetGarbageCollectionResult(secret)) // It is now possible to delete a secret. - return reconcile.Result{}, h.dvcrService.DeleteGarbageCollectionSecret(ctx) + // Test: add delay to catch race condition delete secret -> hook change values -> helm apply new version of deploy/dvcr. + err = h.dvcrService.DeleteGarbageCollectionSecret(ctx) + time.Sleep(time.Second * 10) + return reconcile.Result{}, err } if h.dvcrService.IsGarbageCollectionStarted(secret) {