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

Add strategy description for 'kubectl describe sts' command #63844

Conversation

tossmilestone
Copy link
Member

@tossmilestone tossmilestone commented May 15, 2018

What this PR does / why we need it:
To display UpdateStrategyType and RollingUpdateStrategy information when execute kubectl describe sts command, the output likes:

Name:               web
Namespace:          default
CreationTimestamp:  Thu, 17 May 2018 10:21:19 +0800
Selector:           app=nginx
Labels:             app=nginx
Annotations:        <none>
Replicas:           3 desired | 1 total
Update Strategy:    RollingUpdate
  Partition:        2
Pods Status:        0 Running / 1 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app=nginx
  Containers:
   nginx:
    Image:        k8s.gcr.io/nginx-slim:0.8
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /usr/share/nginx/html from www (rw)
  Volumes:  <none>
Volume Claims:
  Name:          www
  StorageClass:  my-storage-class
  Labels:        <none>
  Annotations:   <none>
  Capacity:      1Gi
  Access Modes:  [ReadWriteOnce]
Events:
  Type    Reason            Age   From                    Message
  ----    ------            ----  ----                    -------
  Normal  SuccessfulCreate  10s   statefulset-controller  create Pod web-0 in StatefulSet web successful

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 None

Special notes for your reviewer:

Release note:

Add 'UpdateStrategyType' and 'RollingUpdateStrategy' to 'kubectl describe sts' command output.

@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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 15, 2018
@tossmilestone
Copy link
Member Author

/assign @janetkuo

@wgliang
Copy link
Contributor

wgliang commented May 15, 2018

/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 May 15, 2018
@@ -2764,6 +2764,12 @@ func describeStatefulSet(ps *apps.StatefulSet, selector labels.Selector, events
printLabelsMultiline(w, "Labels", ps.Labels)
printAnnotationsMultiline(w, "Annotations", ps.Annotations)
w.Write(LEVEL_0, "Replicas:\t%d desired | %d total\n", ps.Spec.Replicas, ps.Status.Replicas)
w.Write(LEVEL_0, "UpdateStrategyType:\t%s\n", ps.Spec.UpdateStrategy.Type)
if ps.Spec.UpdateStrategy.RollingUpdate != nil {
ru := ps.Spec.UpdateStrategy.RollingUpdate
Copy link
Member

Choose a reason for hiding this comment

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

nit: move this line to before if so that you can do if ru != nil

@@ -2764,6 +2764,12 @@ func describeStatefulSet(ps *apps.StatefulSet, selector labels.Selector, events
printLabelsMultiline(w, "Labels", ps.Labels)
printAnnotationsMultiline(w, "Annotations", ps.Annotations)
w.Write(LEVEL_0, "Replicas:\t%d desired | %d total\n", ps.Spec.Replicas, ps.Status.Replicas)
w.Write(LEVEL_0, "UpdateStrategyType:\t%s\n", ps.Spec.UpdateStrategy.Type)
Copy link
Member

Choose a reason for hiding this comment

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

"Update Strategy:"

w.Write(LEVEL_0, "UpdateStrategyType:\t%s\n", ps.Spec.UpdateStrategy.Type)
if ps.Spec.UpdateStrategy.RollingUpdate != nil {
ru := ps.Spec.UpdateStrategy.RollingUpdate
w.Write(LEVEL_0, "RollingUpdateStrategy:\t%d partition\n", ru.Partition)
Copy link
Member

Choose a reason for hiding this comment

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

This can be LEVEL_1, "Partition:".

Suggest not printing partition when the value is 0 (no partition).

@janetkuo
Copy link
Member

cc @kow3ns

@tossmilestone tossmilestone force-pushed the add-statefulset-strategy-desc branch from fef0f41 to 2fd7313 Compare May 17, 2018 02:29
@tossmilestone
Copy link
Member Author

@janetkuo updated, PTAL!

@tossmilestone
Copy link
Member Author

/cc @kow3ns

@k8s-ci-robot k8s-ci-robot requested a review from kow3ns May 17, 2018 06:22
@janetkuo
Copy link
Member

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: janetkuo, tossmilestone

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 May 17, 2018
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 63871, 63927, 63966, 63957, 63844). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 64bb688 into kubernetes:master May 17, 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. 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.

5 participants