Skip to content

Highlight Current Namespace in kubectl get ns #1708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pmaddev opened this issue Feb 3, 2025 · 6 comments
Closed

Highlight Current Namespace in kubectl get ns #1708

pmaddev opened this issue Feb 3, 2025 · 6 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@pmaddev
Copy link

pmaddev commented Feb 3, 2025

Enhancement Proposal: Highlight Current Namespace in kubectl get ns

Current Behavior

  • kubectl get ns does not highlight the current namespace.
  • Users have to run kubectl config view --minify to check the namespace.

Proposed Change

  • Display an * next to the currently active namespace.
  • Ensure this behavior applies when -A (All Namespaces) is used.

Expected Output Example

$ kubectl get ns
NAME              STATUS   AGE
default *        Active   3d19h
kube-system     Active   3d19h  <-- Current namespace is marked

$ kubectl get pods -A
NAMESPACE         NAME                                       READY   STATUS    RESTARTS   AGE
foo          foo-abc648d6cdb9-n5h2s                1/1     Running   0          3d12h
foo          foo-5ccbd77b5f-tlrft                        1/1     Running   0          3d12h
default *        webapp-6789d5d66b-djhs2                    1/1     Running   0          3d19h
default *        backend-9bcd77d5f-tlrft                    1/1     Running   0          3d19h
kube-flannel     kube-flannel-ds-xkw2s                      1/1     Running   0          3d15h
kube-system      kube-apiserver-node1                       1/1     Running   0          3d19h
kube-system      kube-controller-manager-node1              1/1     Running   0          3d19h
kube-system      kube-scheduler-node1                       1/1     Running   0          3d19h
kube-system      etcd-node1                                 1/1     Running   0          3d19h


The default namespace is marked with *, making it easy to spot which namespace is currently in use.
@pmaddev pmaddev added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 3, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 3, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@pmaddev
Copy link
Author

pmaddev commented Feb 3, 2025

I am interested and would like to take up this issue, if allowed

@2003Aditya
Copy link

Hey, I'd like to work on this issue! Is it available for assignment?

@sftim
Copy link

sftim commented Feb 18, 2025

Kubernetes is open source; you inherently have permission to propose an improvement.

@mpuckett159
Copy link
Contributor

My recommendation for this feature request is to create plugin instead of trying to update the code as is for kubectl. You will likely want to take the output of kubectl and do some text parsing rather than try to figure out how to do the same thing inside of the kubectl codebase itself. Because we're suggesting a plugin I'm going to close this and not accept.
/close

@k8s-ci-robot
Copy link
Contributor

@mpuckett159: Closing this issue.

In response to this:

My recommendation for this feature request is to create plugin instead of trying to update the code as is for kubectl. You will likely want to take the output of kubectl and do some text parsing rather than try to figure out how to do the same thing inside of the kubectl codebase itself. Because we're suggesting a plugin I'm going to close this and not accept.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

5 participants