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

Improve human-readable output of Deployments and StatefulSets #70466

Merged
merged 1 commit into from
Nov 13, 2018

Conversation

Pingan2017
Copy link
Member

@Pingan2017 Pingan2017 commented Oct 31, 2018

What type of PR is this?

/kind feature
/sig cli

What this PR does / why we need it:
add Ready column for kubectl get sts command

[root@hpa-vm:/opt/kubernetes/1.4.5]$ kubectl get deploy
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   0/1     1            0           10m
[root@hpa-vm:/opt/kubernetes/1.4.5]$ 
[root@hpa-vm:/opt/kubernetes/1.4.5]$ kubectl get sts
NAME   READY   AGE
web    3/3     47m

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:
/cc @soltysh
Does this PR introduce a user-facing change?:

add `Ready` column and improve human-readable output of Deployments and StatefulSets

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 31, 2018
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. sig/cli Categorizes an issue or PR as relevant to SIG CLI. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 31, 2018
@idealhack
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 31, 2018
@Pingan2017
Copy link
Member Author

/assign @janetkuo

@juanvallejo
Copy link
Contributor

@Pingan2017 thanks for addressing this. While you're in this part of the codebase, would you mind updating the overall output to be consistent with what is detailed in #68623 ?

Also, would be great if you'd like to address this for Deployments as well.

Thanks

@Pingan2017 Pingan2017 changed the title add 'Ready' column for kubectl get sts command [WIP]add 'Ready' column for kubectl get sts command Nov 2, 2018
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 2, 2018
@Pingan2017 Pingan2017 force-pushed the get-statefulset branch 2 times, most recently from 11cbafa to aeb86d2 Compare November 8, 2018 02:41
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 8, 2018
@Pingan2017 Pingan2017 changed the title [WIP]add 'Ready' column for kubectl get sts command Improve human-readable output of Deployments and StatefulSets Nov 8, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2018
@Pingan2017
Copy link
Member Author

@juanvallejo PTAL, Thanks!

Copy link
Member

@idealhack idealhack left a comment

Choose a reason for hiding this comment

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

few nits, otherwise lgtm

@@ -1042,9 +1040,9 @@ func printStatefulSet(obj *apps.StatefulSet, options printers.PrintOptions) ([]m
Object: runtime.RawExtension{Object: obj},
}
desiredReplicas := obj.Spec.Replicas
currentReplicas := obj.Status.Replicas
readyReplicas := obj.Status.ReadyReplicas
Copy link
Member

Choose a reason for hiding this comment

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

Since the idea is to merge current/desired to ready, I don't think this renaming is worthy.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, but could you explain why to choose obj.Status.ReadyReplicas instead of obj.Status.Replicas here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it will make ambiguous sometimes for users.
sometimes , the pod is not Ready, but the current and desired is equal. the Ready (1/1) will make users think the deployment is available.

[root@hpa-vm:/etc/kubernetes]$ kubectl get deploy
NAME               READY   UP-TO-DATE   AVAILABLE   AGE
nginx-deployment   1/1     1           0           45m

OR we can using CURRENT instead of READY?
I dont think Ready is a good idea to show current/desired

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, that's making sense now. I'll defer the choice to @kubernetes/sig-cli-feature-requests

updatedReplicas := obj.Status.UpdatedReplicas
readyReplicas := obj.Status.ReadyReplicas
Copy link
Member

Choose a reason for hiding this comment

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

same here ^

@idealhack
Copy link
Member

And you need to update tests too

@Pingan2017 Pingan2017 force-pushed the get-statefulset branch 2 times, most recently from 3de0db6 to 77b0ddc Compare November 9, 2018 03:19
@Pingan2017
Copy link
Member Author

/test pull-kubernetes-e2e-kops-aws

@juanvallejo
Copy link
Contributor

/lgtm

cc @soltysh for approval

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

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/approve
A few nits that I'd like to see addressed:
/lgtm cancel
and also please update release notes, your change is a user facing one, so you need to have on.

@@ -203,8 +203,7 @@ func AddHandlers(h printers.PrintHandler) {

statefulSetColumnDefinitions := []metav1beta1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "Desired", Type: "string", Description: appsv1beta1.StatefulSetSpec{}.SwaggerDoc()["replicas"]},
{Name: "Current", Type: "string", Description: appsv1beta1.StatefulSetStatus{}.SwaggerDoc()["replicas"]},
{Name: "Ready", Type: "string", Description: "the number of the pod with ready state"},
Copy link
Contributor

Choose a reason for hiding this comment

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

s/the number/Number

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! fix it.

@@ -313,8 +312,7 @@ func AddHandlers(h printers.PrintHandler) {

deploymentColumnDefinitions := []metav1beta1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "Desired", Type: "string", Description: extensionsv1beta1.DeploymentSpec{}.SwaggerDoc()["replicas"]},
{Name: "Current", Type: "string", Description: extensionsv1beta1.DeploymentStatus{}.SwaggerDoc()["replicas"]},
{Name: "Ready", Type: "string", Description: "the number of the pod with ready state"},
Copy link
Contributor

Choose a reason for hiding this comment

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

s/the number/Number

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2018
@soltysh
Copy link
Contributor

soltysh commented Nov 9, 2018

/milestone v1.13

@k8s-ci-robot k8s-ci-robot added this to the v1.13 milestone Nov 9, 2018
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Nov 10, 2018
@Pingan2017
Copy link
Member Author

@soltysh Updated. PTAL, Thanks!

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

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Pingan2017, soltysh

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 Nov 13, 2018
@k8s-ci-robot k8s-ci-robot merged commit a88f297 into kubernetes:master Nov 13, 2018
@Pingan2017 Pingan2017 deleted the get-statefulset branch November 21, 2018 01:19
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants