Skip to content
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

Give APIServer pretty column output #67747

Merged
merged 1 commit into from
Aug 30, 2018

Conversation

smarterclayton
Copy link
Contributor

@smarterclayton smarterclayton commented Aug 23, 2018

Simple server side render that prints the implementing service (if any)
and the available condition.

$ kubectl get apiservice
NAME                               SERVICE                      AVAILABLE                 AGE
v1.                                Local                        True                      10m
v1.apps                            Local                        True                      10m
v1.authentication.k8s.io           Local                        True                      10m
v2beta1.autoscaling                Local                        True                      10m
v1beta1.metrics                    kube-system/metrics-server   False (DiscoveryFailed)   10m

@liggitt @deads2k helps to debug why controllers block (aggregate api is down)

`kubectl get apiservice` now shows the target service and whether the service is available

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 23, 2018
@k8s-ci-robot k8s-ci-robot requested review from cheftako and sttts August 23, 2018 03:32
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Aug 23, 2018
{Name: "Name", Type: "string", Format: "name", Description: swaggerMetadataDescriptions["name"]},
{Name: "Service", Type: "string", Description: "The reference to the service that hosts this API endpoint."},
{Name: "Available", Type: "string", Description: "Whether this service is available."},
{Name: "Age", Type: "string", Description: swaggerMetadataDescriptions["creationTimestamp"]},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't we have some special format or type for the age column to be printed properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we actually implemented it. I think it would be type=string, format=age or format=duration. I can do a follow up PR and set format duration on all the things (every age column)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's type "date".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An age string is not a date though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the wire it's a date, in the kubectl output it's an age. Yes, strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the wire it's row.Cells, err = rowFn(obj, m, m.GetName(), ConvertToHumanReadableDateType(m.GetCreationTimestamp())) on all types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soltysh you wanted to look into the current code? Anything to add? I don't want to block this due to my comment. Just had the impression we use "date" elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did, I'm fine with the current code. It is consistent with the others.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

ColumnDefinitions: []metav1beta1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: swaggerMetadataDescriptions["name"]},
{Name: "Service", Type: "string", Description: "The reference to the service that hosts this API endpoint."},
{Name: "Available", Type: "string", Description: "Whether this service is available."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while pretty, our mechanism somehow failed if we have to turn a bool into a string. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually do this for other columns because we're not returning a bool, we're returning a human focused message. I.e. True and False are ok, but we really want to give a user the reason as well, because that answers the why. This is parallel to how pod status, node status, etc work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the ready column is presented as 0/2 or 2/3 which allows multiple columns to be compressed, improving information density and reducing the number of follow up actions a user needs to take (yes, I know it's not ready, but HOW MUCH is it not ready, etc)

@sttts
Copy link
Contributor

sttts commented Aug 23, 2018

pretty indeed 👍

@lavalamp
Copy link
Member

/assign @caesarxuchao

Simple server side render that prints the implementing service (if any)
and the available condition.

```
$ kubectl get apiservice
NAME                                   SERVICE                      AVAILABLE                 AGE
v1.                                    Local                        True                      10m
v1.apps                                Local                        True                      10m
v1.authentication.k8s.io               Local                        True                      10m
v2beta1.autoscaling                    Local                        True                      10m
v1beta1.metrics                        kube-system/metrics-server   False (DiscoveryFailed)   10m
```
@caesarxuchao
Copy link
Member

lgtm

/assign @sttts
/unassign

@k8s-ci-robot k8s-ci-robot assigned sttts and unassigned caesarxuchao Aug 24, 2018
@smarterclayton
Copy link
Contributor Author

Any other comments then?

@sttts
Copy link
Contributor

sttts commented Aug 29, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smarterclayton, sttts

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

1 similar comment
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@smarterclayton
Copy link
Contributor Author

/retest

1 similar comment
@caesarxuchao
Copy link
Member

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@smarterclayton smarterclayton added this to the v1.12 milestone Aug 29, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

@k8s-github-robot k8s-github-robot merged commit 72ef97a into kubernetes:master Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants