From 93ef1515ea68be9e289af225f2c2f328a9366a0c Mon Sep 17 00:00:00 2001 From: Vladislav Klimenko Date: Sun, 15 Dec 2024 12:44:06 +0300 Subject: [PATCH] dev: restore cr state before reconcile --- pkg/controller/chi/worker.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/controller/chi/worker.go b/pkg/controller/chi/worker.go index 438daa81b..e66ee7dfe 100644 --- a/pkg/controller/chi/worker.go +++ b/pkg/controller/chi/worker.go @@ -327,6 +327,14 @@ func (w *worker) updateCHI(ctx context.Context, old, new *api.ClickHouseInstalla return nil } + if new != nil { + n, err := w.c.kube.CR().Get(ctx, new.GetNamespace(), new.GetName()) + if err != nil { + return err + } + new = n.(*api.ClickHouseInstallation) + } + if w.deleteCHI(ctx, old, new) { // CHI is being deleted return nil