Skip to content

Replace @clusterRequired #2878

@datho7561

Description

@datho7561

It would be nice to fix the prompt to log in to a cluster when you perform an operation that requires a cluster but aren't logged into one. Currently, the prompt sometimes appears if you've never logged into a cluster on your computer (i.e. .kube/config is empty), but it doesn't count you as logged out if you've logged into a cluster and then logged out (i.e. you still have the cluster set as current-context).

We could use oc whoami to detect the current user and make sure it isn't system:anonymous (the username when not logged in). However, this will only work in OpenShift.

We could look into https://stackoverflow.com/questions/57004093/how-to-retrieve-current-user-granted-rbac-with-kubectl to see if that method is viable to detect if the user is logged on. eg. 'the user is considered logged on if they can create pods in the current namespace' or something similar.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions