Improve set active or create new project/namespace workflow#4122
Conversation
7331fce to
f817a28
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4122 +/- ##
===========================================
+ Coverage 32.37% 44.60% +12.23%
===========================================
Files 85 88 +3
Lines 6505 7113 +608
Branches 1349 1502 +153
===========================================
+ Hits 2106 3173 +1067
+ Misses 4399 3940 -459 ☔ View full report in Codecov by Sentry. |
|
I haven't tried this on an OpenShift instance, I've been using |
@datho7561 This would be really helpful. |
I use Kube config to detect an active project, because the way I run The problem may happen when Kube config has active project set, but that project doesn't really exist on the cluster. |
f817a28 to
4906029
Compare
|
Changed
|
|
Things dont work for me properly when only listing pods is allowed (as instructed in #3999): $ kubectl get pod -n default
NAME READY STATUS RESTARTS AGE
apple-app 1/1 Running 0 67m
banana-app 1/1 Running 0 67m
frontend-9cr6z 0/1 ImagePullBackOff 0 67m
frontend-kjrpx 0/1 ErrImagePull 0 67m
frontend-vbhb7 0/1 ErrImagePull 0 67m
mehdb-0 0/1 CrashLoopBackOff 18 (15s ago) 68m
sise-deploy-69d88467b4-vhfsd 0/1 CrashLoopBackOff 3415 (2m10s ago) 58dI think that you cannot know if a namespace exists or not if you're not allowed to get the namespace resource or all the namespaces.
$ kubectl get ns default
Error from server (Forbidden): namespaces "default2" is forbidden: User "user1" cannot get resource "namespaces" in API group "" in the namespace "default"
$ kubectl get ns default2
Error from server (Forbidden): namespaces "default2" is forbidden: User "user1" cannot get resource "namespaces" in API group "" in the namespace "default2"
|
|
Furthermore I cannot select my current namespace. I cannot confirm the upcoming prompt by hitting the return key, it stays open (namespace "default" exists, I simply cannot retrieve it. I can only retrieve pods within it): Screen.Recording.2024-05-15.at.17.04.57.mov |
4906029 to
4d0a1bd
Compare
It's a filter, not an input field for a project/namespace name, you should click Screencast.from.2024-05-15.18-17-48.webm |
|
I've made no item like |
27e29db to
d087993
Compare
There was a problem hiding this comment.
@vrubezhny Things work fine now 😄
I can use the namespace "default", there's no warning "Missing Namespace" any more and I can list the pods that are running and that I am allowed to list (according to my custom, restrictive RBAC).
The only thing that I am wondering about is that listing forbidden resources cause error notifications to appear while the cathegory stays empty.

I am wondering if a child node with the error would be preferrable (screenshot of intellij-kubernetes)?

@datho7561 What do you think about this proposal? |
I like this idea. |
|
I think we can use |
aa392f2 to
121fae5
Compare
The current PR version is updated to use Also, |
121fae5 to
daf9a93
Compare
|
The Screencast.from.2024-05-16.22-39-15.webmTested using the "restricted" Kind cluster service account created according the redhat-developer/idetools.dev#49 |
daf9a93 to
58aa471
Compare
382d4f3 to
beaaeec
Compare
|
Now the App. Explorer Tree on a "restricted" cluster looks like the following: cc @adietish |
|
@vrubezhny feel free to merge, unless you want to wait on feedback from Andre on the appearance of the error tree nodes. |
- Now, when switching projects/namespaces, one can manually type in a project name to be set as an active one. - No more 'Missing project/namespace' item for a project/namespace that doesn't exist on a cluster. This allows working normally on clusters with restrictions on list for projects. Fixes: redhat-developer#3999 - The project listing is fixed, so annotated projects are shown now Fixes: redhat-developer#4101 - For a Sandbox cluster a project which name contains current user name is used as a default one when logging in (A follow up to redhat-developer#4109) Issue: redhat-developer#4080 (?) Improved the detection whether we're logged in to a cluster or not. Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
beaaeec to
0c81c4e
Compare



working normally on clusters with restrictions on list for projects.
Fixes: #3999
Fixes: #4101
Issue: #4080 (?)