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

kubectl get priorityclass prints value column #69431

Merged
merged 1 commit into from
Oct 13, 2018

Conversation

Huang-Wei
Copy link
Member

What this PR does / why we need it:

Prints out value column when running kubectl get priorityclass.

$ kubectl get priorityclass
NAME                      VALUE        AGE
system-cluster-critical   2000000000   6m33s
system-node-critical      2000001000   6m33s

Before:

$ kubectl get priorityclass
NAME                      CREATED AT
system-cluster-critical   2018-10-04T06:18:27Z
system-node-critical      2018-10-04T06:18:27Z

Special notes for your reviewer:

  • If necessary, other columns can be added as well, or to -o wide columns.
  • Optionally we can follow storageclass way to append (global default) to the name if it's a global default priorityclass.

Release note:

`kubectl get priorityclass` now prints value column by default.

/kind feature
/sig cli
/sig scheduling

@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. kind/feature Categorizes issue or PR as related to a new feature. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 4, 2018
@Huang-Wei
Copy link
Member Author

@kubernetes/sig-cli-pr-reviews

@Huang-Wei
Copy link
Member Author

@bsalamat @liggitt could you take a chance to review this? Thanks.

Copy link
Member

@dixudx dixudx left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2018
@nikhita
Copy link
Member

nikhita commented Oct 9, 2018

/assign @deads2k
for approval

@liggitt
Copy link
Member

liggitt commented Oct 9, 2018

should we include the GlobalDefault field value? that seems more useful than the creation time

@dixudx
Copy link
Member

dixudx commented Oct 9, 2018

should we include the GlobalDefault field value? that seems more useful than the creation time

Yeah. Correct. @liggitt 👍

@Huang-Wei
Copy link
Member Author

Huang-Wei commented Oct 9, 2018

@liggitt I think so. Basically there are two options:

  • add it as part of Name column (sort of like how StorageClass prints)

    NAME                          VALUE        AGE
    priority1 (global default)    2000000000   6m33s
  • or put it in a separated column

    NAME        GLOBAL_DEFAULT    VALUE        AGE
    priority1   true              2000000000   6m33s

BTW: as PriorityClass is mostly used and designed by @bsalamat in preemption logic. I'd like to hear about Bobby's comments.

@bsalamat
Copy link
Member

bsalamat commented Oct 9, 2018

Thanks Wei for this improvement. I would prefer the following output:

NAME         VALUE        GLOBAL_DEFAULT      AGE
priority1    2000000000   true                6m33s

This is very similar to what you wrote. It just puts "value" before "global default". Value is more important in my opinion. Hence, it is show before global default.
This is just my personal preference though. It has nothing to do with the fact that I have designed pod priority. In other words, there is no technical wisdom behind my suggestion! :-)

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 10, 2018
@Huang-Wei
Copy link
Member Author

Added GLOBAL-DEFAULT column. @bsalamat @liggitt @dixudx PTAL.

BTW: according to kubectl dev guide, it said:

Column titles and values should not contain spaces in order to facilitate commands that break lines into fields: cut, awk, etc. Instead, use - as the word separator.

So I used - over _:

NAME                      VALUE        GLOBAL-DEFAULT   AGE
system-cluster-critical   2000000000   false            38s
system-node-critical      2000001000   false            38s

And I do see other API objects follow this convention:

NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   3m11s

@Huang-Wei
Copy link
Member Author

/retest

Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks, @Huang-Wei! We should add "Description" to "-o wide" as well.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 10, 2018
@Huang-Wei
Copy link
Member Author

@bsalamat hmm, I'm a little hesitant on adding Description column, as:

  1. there is no API object has this kind of column
  2. it will breaks Column titles and values should not contain spaces, and maybe has string truncation issue.

So maybe better for users to use -o json/yaml/... to get "description" info.

@bsalamat
Copy link
Member

@Huang-Wei I agree. In fact, since kubectl describe priorityClass shows description of priority classes, users have a way to see the description and we don't need to have it here in get.

@Huang-Wei
Copy link
Member Author

@bsalamat yeap, that makes sense.

/cc @liggitt @deads2k for approval.

@liggitt
Copy link
Member

liggitt commented Oct 12, 2018

/lgtm

@liggitt
Copy link
Member

liggitt commented Oct 12, 2018

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Huang-Wei, liggitt

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2018
@k8s-ci-robot k8s-ci-robot merged commit 509fd5c into kubernetes:master Oct 13, 2018
@Huang-Wei Huang-Wei deleted the kubectl-prioriyclass branch October 13, 2018 06:24
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. kind/feature Categorizes issue or PR as related to a new feature. 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/cli Categorizes an issue or PR as relevant to SIG CLI. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. 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.

None yet

7 participants