k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Add Namespace viewer for OpenShift Projects in registrar

Open zkck opened this issue 2 years ago • 4 comments

Closes #2224

Adding OpenShift Projects to the registrar, so that its view behaves like Namespaces. This great codebase made this easy, thanks for this great tool!

zkck avatar Oct 28 '23 09:10 zkck

Hi @derailed

Thanks for your review!

OpenShift Projects are explained as an "alternate representation for a Kubernetes namespace", and is used in OpenShift to isolate members into different collaboration groups. When you create a Project in OpenShift, a Namespace then exists with the same name as the Project.

The reason for my PR is because people working in OpenShift do not generally have access to list Namespaces across the cluster, but they have the permissions to list Projects, which lists the Projects that the user has access to. So switching Projects is tedious, since setting the Project requires leaving k9s, listing/setting the Project with the OpenShift CLI (oc). This PR would allow to stay inside k9s.

In terms of whether or not this would cause issues down the line, IMO the fact that a Project is just OpenShift's abstraction of Namespaces and that they both share the exact same resource name gives us a lot of guarantees.

Another link: https://docs.openshift.com/container-platform/4.14/applications/projects/working-with-projects.html

zkck avatar Nov 22 '23 11:11 zkck

I have 2 openshift clusters, I can test this pull request.

slimus avatar Nov 25 '23 03:11 slimus

Thanks @slimus :smile:

Just a quick note, I tested this locally with OpenShift Local, and for me :projects listed another CR by default (from config.openshift.io/v1), so you may need to use the full :project.openshift.io/v1/projects or add aliases for it. Hope this helps :+1:

zkck avatar Nov 25 '23 10:11 zkck

Hi @zkck thanks for the PR. Any update on when this will be merged and added to the next release? I would highly appreciate this feature, because change projects is really the most annoying part about k9s. I always quit the tool, type oc project <myProject> and start k9s back up and I do this like 50 times per day.

LennartRoeder avatar Feb 02 '24 13:02 LennartRoeder