HNC: Show right namespaces in `kubectl hns tree --all-namespaces`
yiqigao217 opened this issue · comments
- Namespaces with conditions are missing in the
kubectl hns tree --all-namespaces
output. - Another improvement would be adding additional highlights on excluded namespaces in
kubectl hns
plugins to differentiate the namespaces.
Here's what I got currently:
$ kubectl get ns
NAME STATUS AGE
default Active 22h
hnc-system Active 21h
kube-node-lease Active 22h
kube-public Active 22h
kube-system Active 22h
service-2 Terminating 47m
team-a Active 47m
team-b Active 47m
$ kubectl hns tree --all-namespaces #### team-a and team-b are not listed here
default
hnc-system
kube-node-lease
kube-public
kube-system
service-2
Conditions:
1) ActivitiesHalted (ParentMissing): Parent "acme-org" does not exist
$ kubectl hns tree team-a
team-a (1)
Conditions:
1) ActivitiesHalted (ParentMissing): Parent "acme-org" does not exist
$ kubectl hns tree team-b
team-b (1)
Conditions:
1) ActivitiesHalted (ParentMissing): Parent "acme-org" does not exist
multi-tenancy is very useful, I'd like to work on this.
/assign
@yiqigao217 since I am new here, would you please give me a hint where should I start?
Hi @FingerLiu sorry for the late reply. The kubectl hns tree
command are defined in https://github.com/kubernetes-sigs/multi-tenancy/blob/master/incubator/hnc/internal/kubectl/tree.go .
Please note only namespaces with conditions are not shown in the kubectl hns tree --all-namespaces
. The easiest way to produce a condition is to delete the parent namespace, so that the namespace would have ActivitiesHalted (ParentMissing)
condition that you can test with.
To test your kubectl hns plugin, you may need to remove the current kubectl hns plugin if you already have one and run make kubectl
. You can find the kubectl plugin path at https://github.com/kubernetes-sigs/multi-tenancy/blob/master/incubator/hnc/Makefile#L120-L121.
It looks clear to me now, thanks.
Moved to kubernetes-sigs/hierarchical-namespaces#15
/close
@adrianludwin: Closing this issue.
In response to this:
Moved to kubernetes-sigs/hierarchical-namespaces#15
/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/test-infra repository.