-
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
Human-readable revision describe #475
Human-readable revision describe #475
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.
Thanks, looks good to me !
Two points:
- We shouldn't print a concurrency limit of 0 imo (it does mean to use the default limit, right ? So can just be left out or replaced by this default limit if we are able to query that)
- We should reuse the common code of
kn service describe
andkn revision describe
. But we can leave that for a later PR.
pkg/kn/commands/revision/describe.go
Outdated
if ok { | ||
serviceSection := dw.WriteAttribute("Service", serviceName) | ||
if printDetails { | ||
serviceSection.WriteAttribute("Config Gen", revision.Labels[servingserving.ConfigurationGenerationLabelKey]) |
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.
As we are in verbose mode anyway, could we expand this to "Configuration Generation" or maybe just "Generation" ? (compromise: "Config Generation")
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.
sure
} | ||
|
||
// Format scale in the format "min ... max" with max = ∞ if not set | ||
func formatScale(minScale *int, maxScale *int) 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 we move that up to a FormatScale
, reusable by service describe
?
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.
Oh dang, it looks like I slightly misued git and forgot part of the refactor when I resurrected this PR. Resurrecting that :)
} | ||
|
||
// Write request ... limits or only one of them | ||
func writeResourcesHelper(dw printers.PrefixWriter, label string, request *resource.Quantity, limit *resource.Quantity) { |
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.
This method should be unified with the printing code for service describe
.
return ret | ||
} | ||
|
||
func stringifyEnv(revision *v1alpha1.Revision) []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.
unify with service describe
.
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.
A few suggestions, but not necessarily required to take in
pkg/kn/commands/revision/describe.go
Outdated
|
||
envVars := make([]string, 0, len(container.Env)) | ||
for _, env := range container.Env { | ||
var value 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.
value := env.Value
if env.ValueFrom != nil {
value = "[ref]"
}
var percent int64 | ||
tags := []string{} | ||
for _, target := range service.Status.Traffic { | ||
if target.RevisionName == name { |
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.
if target.RevisionName != name {
continue
}
if target.Percent != nil {
percent += *target.Percent
}
if target.Tag != "" {
tags = append(tags, target.Tag)
}
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.
A few error checks missing in addition to current comments.
Thanks for contribution.
pkg/kn/commands/revision/describe.go
Outdated
|
||
func WriteScale(dw printers.PrefixWriter, revision *v1alpha1.Revision) { | ||
// Scale spec if given | ||
scale, _ := clientserving.ScalingInfo(&revision.ObjectMeta) |
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.
Don't want to nag but ignoring errors here... could easily be handled IMO.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, sixolet 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 |
/retest |
The following is the coverage report on the affected files.
|
/lgtm |
Revision describe based on new format for service describe.
Non-verbose:
Verbose (note the extra info about service):