From e7779475395aafbe5199e1d70cd34d8e29f54358 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Thu, 8 Sep 2022 10:43:31 +0300 Subject: [PATCH] Remove finalizers for OCI repositories on uninstall Signed-off-by: Stefan Prodan --- cmd/flux/uninstall.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/flux/uninstall.go b/cmd/flux/uninstall.go index e16552df..5e3d8b55 100644 --- a/cmd/flux/uninstall.go +++ b/cmd/flux/uninstall.go @@ -198,6 +198,19 @@ func uninstallFinalizers(ctx context.Context, kubeClient client.Client, dryRun b } } } + { + var list sourcev1.OCIRepositoryList + if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil { + for _, r := range list.Items { + r.Finalizers = []string{} + if err := kubeClient.Update(ctx, &r, opts); err != nil { + logger.Failuref("%s/%s/%s removing finalizers failed: %s", r.Kind, r.Namespace, r.Name, err.Error()) + } else { + logger.Successf("%s/%s/%s finalizers deleted %s", r.Kind, r.Namespace, r.Name, dryRunStr) + } + } + } + } { var list sourcev1.HelmRepositoryList if err := kubeClient.List(ctx, &list, client.InNamespace("")); err == nil {