-
Notifications
You must be signed in to change notification settings - Fork 261
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 describe): Output of service details [vanilla, color, hipster] #75
Conversation
Hi @rhuss. 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. |
/ok-to-test |
pkg/kn/commands/service_describe.go
Outdated
} | ||
} | ||
|
||
func (tw *describeWriter) sCol(label string, val string) { |
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.
should this be called dw.sRow as its printing row cells?
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.
good point. 'sCol' was meant to be 'singleColumn' (which actually is not true as there are two cols ;0)
let's call it printlnWithLabel
?
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.
printlnWithLabel
is fine too, though I think soon we'll need a way to print tables, that should constitute a library for kn
.
That library should re-use k8s.io/apimachinery/pkg/apis/meta/v1beta1.TableColumnDefinition
and re-write parts of https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/get/table_printer.go .
That way, describe output becomes a two column table with no-headers bool set.
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.
Sounds good to me. Maybe we can delay the switch until we decided what we actually want to show for kn service describe
. Some suggestions are mentioned in the description of this PR.
If there are no objections, I would work on this list. We can change the fields presented any time anyway.
That library should re-use
k8s.io/apimachinery/pkg/apis/meta/v1beta1.TableColumnDefinition
and re-write parts of kubernetes/kubernetes:pkg/kubectl/cmd/get/table_printer.go@master
.
I wonder whether the proper spot for such a library would be cli-runtime
itself, where the other, machine-readable printers are living ?
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.
Maybe we can delay the switch until we decided what we actually want to show for kn service describe
Yes! I just wanted pitch and get feedback.
I wonder whether the proper spot for such a library would be cli-runtime
Correct, however doing that would eventually increase the timeline for being able to re-use it in kn
. I think we should first target it for kn
, which needs it sooner and then propose for inclusion in cli-runtime.
pkg/kn/commands/service_describe.go
Outdated
Use: "describe NAME", | ||
Short: "Describe available services.", | ||
Short: "Show details for a given service", |
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.
all the short help text in other commands ends with a period (.), lets add it to be consistent when kn help
prints text.
pkg/kn/commands/service_describe.go
Outdated
*/ | ||
} | ||
|
||
func getService(namespace string, name string, p *KnParams) (*v1alpha1.Service, error) { |
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.
We'll be using GetService in multiple commands, this is also a target for including in some package. Fine keeping it here for now.
@rhuss : Lets proceed with the info you mentioned in the issue description. |
@rhuss any plans to address @navidshaikh comments? |
@sixolet I'm going to pick up work this now again @cppforlife yes, I will address @navidshaikh comments As I'm currently on the road (conference), I think I will have an update here until the beginning of next week. |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
pkg/serving/client.go
Outdated
return revisionSlice, nil | ||
} | ||
|
||
// ============================================================================ |
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.
What's the meaning of these //====
? To separate private functions/methods? If yes, I've been using simple // Private funcs
or similar...
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.
Yes, that's an old habit by me (to make it more visible). But happy to remove if this is too distracting.
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.
No I am cool, though we should agree on one approach and use that consistently. Perhaps good to see other opinions on this...
pkg/serving/client.go
Outdated
namespace string | ||
} | ||
|
||
func NewNamespacedClient(client client_v1alpha1.ServingV1alpha1Interface, namespace string) *NamespacedClient { |
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.
Might want to include single line comments for /lint
so something like:
// NewNamespacedClient creates a new client bound to namespace
func NewNamespacedClient(client client_v1alpha1.ServingV1alpha1Interface, namespace string) *NamespacedClient {
...
}
etc.
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.
Good point, I will add those. BTW, I plan to split up this monster PR into multiple PRs (based on each other), and extract eg. the part with this "NamespacedClient" in a separate PR and combine it with #134
Rebase needed: Overall I like the output of the default. I'm trying to think of a different word for "all" because in other contexts "all" typically means "more than one", but here you really mean "expanded view" or "non-compact". Perhaps |
i would suggest changing this a bit to something like this:
|
Agreed that --all is probably not the right name. I like Having an option for restricting the number of revisions is also a good idea, however, it would be cool to get all revisions listed without trial and error to find the proper number of I see the fruit salad format has not many fans, so happy to remove the --hipster option if this is the common consensus. I also agree that If there are no objections, I will remove colour and emoji options, so that we can think on a more general level how to introduce colour. |
"fruit salad" : https://www.youtube.com/watch?v=iRu1Yp2br00&t=33 |
As discussed in knative#48 this `kn service describe` as changed in this commit mimics `kubectl describe <sth>` as that it output detail information in human readable output. Summary information of a list of services or a single services as well as exporting the service in various formats (JSON, YAML) is reserved to `kn service get` For this reason, the generic Printer handling from cli-runtime has been removed as `kn service describe` only outputs human readable format (that is btw also true for `kubectl` describe which does not allow for `-o` kind of options). This command shows information about the serivce itself, but also a summary about the associated revisions. "kn service describe" knows three modes, which can be combined: `--all` : Print more information. By default only are shorter summary is shown `--color` : Use a colorful output (but only when on a tty) `--hipster`: Experimental output mode for a very compact representation using emojis Of course there can be more and other information to be shown. Let's discuss and add this (and maybe remove the dense format)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhuss 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/.
|
@rhuss: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Closing it for now, might serve as a reference if colour or emojis should ever come back. bye, bye hipster 🤓 |
As discussed in #48 this
kn service describe
as changed in this commitmimics
kubectl describe <sth>
as that it output detail informationin human readable output.
Summary information of a list of services or single services as well
as exporting the service in various formats (JSON, YAML) is reserved to
kn service list
(orkn service get
as suggested to align withkubectl conventions).
For this reason, the generic Printer handling from cli-runtime has been
removed as
kn service describe
only outputs human readable format(that is btw also true for
kubectl
describe which does not allow for-o
kind of options).The presented information is just a start and the full content
should be discussed.
For the moment three modes for presenting information are implemented, which can be combined:
--all
: Print more information. By default only are shorter summary is shown--color
: Use a colorful output (but only when on a tty)--hipster
: Experimental output mode for a very compact representation using emojisBelow are some screenshot for different examples, totally open to discuss the format, and it's also ok if the consense is that the emoji thing goes over the top.
kn service describe random
kn service describe random --all
kn service describe random --color
kn service describe random --all --color
kn service describe random --hipster
kn service describe random --hipster --all
kn service describe random --hipster --all --color