-
Notifications
You must be signed in to change notification settings - Fork 263
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
feature(service list): Print NAMESPACE column as the first column when --all-namespaces is specified #366
feature(service list): Print NAMESPACE column as the first column when --all-namespaces is specified #366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toVersus: 1 warning.
In response to this:
/lint
Proposed Changes
kn service list
should print NAMESPACE column when specifying--all-namespaces
option, which follows the kubectl convention.NAMESPACE should be displayed as the first column when --all-namespaces is specified
I know we can find a namespace we deployed our service by inspecting an URL column. It tells us a namespace by default because its FQDN is composed of
{{.Name}}.{{.Namespace}}.{{.Domain}}
. However, we can easily change this FQDN template by modifyingdomainTemplate
field in config-network.yaml. In this case, we have no idea to see a namespace from the output ofkn service list --all-namespace
at a glance. Also, I think it is useful to see a bunch of services in the same namespace by sorting in alphabetical order.
- Print NAMESPACE as the first column when
--all-namespaces
is specified inkn service list
command- Show services in default namespace at the top of the list
- Add unit tests using fake services as well as mock framework
Before:
$ ./kn service list -A NAME URL GENERATION AGE CONDITIONS READY REASON bar http://bar-bar.example.com 1 73m 3 OK / 3 True echo http://echo-bar.example.com 1 73m 3 OK / 3 True echo http://echo-default.example.com 1 6h10m 3 OK / 3 True echo http://echo-foo.example.com 1 74m 3 OK / 3 True foo http://foo-default.example.com 1 6h9m 3 OK / 3 True foo http://foo-foo.example.com 1 74m 3 OK / 3 True hello http://hello-bar.example.com 1 72m 3 OK / 3 True hello http://hello-default.example.com 1 42h 3 OK / 3 True hello http://hello-foo.example.com 1 73m 3 OK / 3 True
After:
$ ./kn service list -A NAMESPACE NAME URL GENERATION AGE CONDITIONS READY REASON default echo http://echo-default.example.com 1 5h51m 3 OK / 3 True default foo http://foo-default.example.com 1 5h51m 3 OK / 3 True default hello http://hello-default.example.com 1 42h 3 OK / 3 True bar bar http://bar-bar.example.com 1 54m 3 OK / 3 True bar echo http://echo-bar.example.com 1 54m 3 OK / 3 True bar hello http://hello-bar.example.com 1 54m 3 OK / 3 True foo echo http://echo-foo.example.com 1 55m 3 OK / 3 True foo foo http://foo-foo.example.com 1 56m 3 OK / 3 True foo hello http://hello-foo.example.com 1 55m 3 OK / 3 True
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.
Hi @toVersus. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Clearly including the NS in there is +1 :-) I'm just wondering about people using I do parse output from cmds like this a lot, but I don't know if I'm in a very small minority. |
@duglin I'm not an enthusiast to use
I think it feels redundant because
IMO, the motivation of |
if err != nil { | ||
fmt.Fprintln(c.OutOrStdout(), err) | ||
} | ||
f.AllNamespaces = all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this other way round and handle it in more generic way ?
As in, flags defined in HumanPrintFlags, gets added to all resource listing commands.
ToPrinter handles it for services, revisions and routes.
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I can handle it in more generic way, but I changed to handle --all-namespace
option in a similar way to kubectl get.
`kn service list` should print NAMESPACE column when specifying `--all-namespace` option, which follows the kubectl convention.
A priority field is handled as follows: - priority 0: print namespace column - priority 1: print default columns - priority 2: print additional columns for wide option
468455f
to
3041b97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few things to clean up and a suggestion to add --with-namespace
for kn service list
command (not to be implemented right now but up for discussion).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toVersus a minor change request, we're good then. Thanks!
029153e
to
c131194
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navidshaikh, toVersus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The following is the coverage report on pkg/.
|
/lint
Proposed Changes
kn service list
should print NAMESPACE column when specifying--all-namespaces
option, which follows the kubectl convention.I know we can find a namespace we deployed our service by inspecting an URL column. It tells us a namespace by default because its FQDN is composed of
{{.Name}}.{{.Namespace}}.{{.Domain}}
. However, we can easily change this FQDN template by modifyingdomainTemplate
field in config-network.yaml. In this case, we have no idea to see a namespace from the output ofkn service list --all-namespace
at a glance. Also, I think it is useful to see a bunch of services in the same namespace by sorting in alphabetical order.--all-namespaces
is specified inkn service list
commandBefore:
After: