Skip to content

Commit

Permalink
Report rancher cluster namespaces under no projects as p-fake
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 11, 2024
1 parent f4a472a commit d5a6c09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/registry/core/project/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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]
Expand Down

0 comments on commit d5a6c09

Please sign in to comment.