fix(storagesvc): scan all namespaces in archivePruner

DefaultNSResolver().Snapshot() returns only namespaces registered via
AddNamespace(). Storagesvc does not listen to namespace events, so tenant
namespaces (fission-*) are never registered and their Package CRDs are
invisible to the pruner — causing all archives to be treated as orphans
and deleted.

Fix: use metav1.NamespaceAll to list Packages across all namespaces.
Remove unused pkg/utils import.

Deployed as naeel/fission-bundle:v1.23.1
This commit is contained in:
“Naeel”
2026-05-19 11:33:52 +04:00
parent 7265985309
commit 33bc765f99
+4 -5
View File
@@ -26,7 +26,6 @@ import (
"github.com/fission/fission/pkg/crd"
"github.com/fission/fission/pkg/generated/clientset/versioned"
"github.com/fission/fission/pkg/utils"
"github.com/fission/fission/pkg/utils/manager"
)
@@ -91,9 +90,10 @@ func (pruner *ArchivePruner) getOrphanArchives(ctx context.Context) {
archivesRefByPkgs := make([]string, 0)
var archiveID string
// get all pkgs from kubernetes
for _, namespace := range utils.DefaultNSResolver().Snapshot() {
pkgList, err := pruner.crdClient.CoreV1().Packages(namespace).List(ctx, metav1.ListOptions{})
// get all pkgs from kubernetes across ALL namespaces (including tenant namespaces)
// Fix: DefaultNSResolver().Snapshot() returns only fission-registered namespaces,
// not tenant namespaces (fission-*). Use NamespaceAll to scan everything.
pkgList, err := pruner.crdClient.CoreV1().Packages(metav1.NamespaceAll).List(ctx, metav1.ListOptions{})
if err != nil {
pruner.logger.Error("error getting package list from kubernetes", zap.Error(err))
return
@@ -122,7 +122,6 @@ func (pruner *ArchivePruner) getOrphanArchives(ctx context.Context) {
archivesRefByPkgs = append(archivesRefByPkgs, archiveID)
}
}
}
pruner.logger.Debug("archives referenced by packagese", zap.Strings("archives", archivesRefByPkgs))