From d5a6c09a04561d0d2054ae0d5e1facf7cf805d9e Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 10 Sep 2024 20:20:46 -0700 Subject: [PATCH] Report rancher cluster namespaces under no projects as p-fake Signed-off-by: Tamal Saha --- pkg/registry/core/project/storage.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/registry/core/project/storage.go b/pkg/registry/core/project/storage.go index e65669d10..4f3cc1ab1 100644 --- a/pkg/registry/core/project/storage.go +++ b/pkg/registry/core/project/storage.go @@ -122,6 +122,8 @@ func (r *Storage) ConvertToTable(ctx context.Context, object runtime.Object, tab return r.convertor.ConvertToTable(ctx, object, tableOptions) } +const fakeProjectId = "p-fake" + func ListRancherProjects(kc client.Client) ([]rscoreapi.Project, error) { var list core.NamespaceList err := kc.List(context.TODO(), &list) @@ -136,7 +138,7 @@ func ListRancherProjects(kc client.Client) ([]rscoreapi.Project, error) { for _, ns := range list.Items { projectId, exists := ns.Labels[clustermeta.LabelKeyRancherFieldProjectId] if !exists { - continue + projectId = fakeProjectId } project, exists := projects[projectId]