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

Merged
merged 1 commit into from May 17, 2018

Conversation

Projects
None yet
5 participants
@tossmilestone
Copy link
Contributor

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.
@tossmilestone

This comment has been minimized.

Copy link
Contributor Author

tossmilestone commented May 15, 2018

/assign @janetkuo

@wgliang

This comment has been minimized.

Copy link
Member

wgliang commented May 15, 2018

/ok-to-test

@@ -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

This comment has been minimized.

@janetkuo

janetkuo May 17, 2018

Member

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)

This comment has been minimized.

@janetkuo

janetkuo May 17, 2018

Member

"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)

This comment has been minimized.

@janetkuo

janetkuo May 17, 2018

Member

This can be LEVEL_1, "Partition:".

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

@janetkuo

This comment has been minimized.

Copy link
Member

janetkuo commented May 17, 2018

cc @kow3ns

@tossmilestone tossmilestone force-pushed the tossmilestone:add-statefulset-strategy-desc branch from fef0f41 to 2fd7313 May 17, 2018

@tossmilestone

This comment has been minimized.

Copy link
Contributor Author

tossmilestone commented May 17, 2018

@janetkuo updated, PTAL!

@tossmilestone

This comment has been minimized.

Copy link
Contributor Author

tossmilestone commented May 17, 2018

/cc @kow3ns

@k8s-ci-robot k8s-ci-robot requested a review from kow3ns May 17, 2018

@janetkuo

This comment has been minimized.

Copy link
Member

janetkuo commented May 17, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label May 17, 2018

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented May 17, 2018

[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-github-robot

This comment has been minimized.

Copy link
Contributor

k8s-github-robot commented May 17, 2018

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

18 checks passed

Submit Queue Queued to run github e2e tests a second time.
Details
cla/linuxfoundation tossmilestone authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Job succeeded.
Details
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Skipped
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details

juanvallejo added a commit to juanvallejo/kubernetes that referenced this pull request May 17, 2018

Merge pull request kubernetes#63844 from tossmilestone/add-statefulse…
…t-strategy-desc

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 <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add strategy description for 'kubectl describe sts' command

**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**:

```release-note
Add 'UpdateStrategyType' and 'RollingUpdateStrategy' to 'kubectl describe sts' command output.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.