From 92c004ada0e456b0ded72b58d5e4da7bd817b404 Mon Sep 17 00:00:00 2001 From: hongming Date: Tue, 14 Jan 2025 14:38:50 +0800 Subject: [PATCH] Support deleting repo and apps in repo (#1979) Signed-off-by: hongming --- pkg/controller/application/helm_repo_controller.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controller/application/helm_repo_controller.go b/pkg/controller/application/helm_repo_controller.go index 2e49f2e71..d120a8b0b 100644 --- a/pkg/controller/application/helm_repo_controller.go +++ b/pkg/controller/application/helm_repo_controller.go @@ -244,6 +244,9 @@ func (r *RepoReconciler) Reconcile(ctx context.Context, request reconcile.Reques } versions = filterVersions(versions) + if len(versions) > appv2.MaxNumOfVersions { + versions = versions[:appv2.MaxNumOfVersions] + } vRequests, err := repoParseRequest(r.Client, versions, helmRepo, appName, appList) if err != nil { @@ -306,8 +309,8 @@ func repoParseRequest(cli client.Client, versions helmrepo.ChartVersions, helmRe } for _, i := range appVersionList.Items { - LegalVersion := application.FormatVersion(i.Spec.VersionName) - key := fmt.Sprintf("%s-%s", i.GetLabels()[appv2.AppIDLabelKey], LegalVersion) + legalVersion := application.FormatVersion(i.Spec.VersionName) + key := fmt.Sprintf("%s-%s", i.GetLabels()[appv2.AppIDLabelKey], legalVersion) _, exists := versionMap[key] if !exists { klog.Infof("delete appversion %s", i.GetName())