Commit Graph

517 Commits (f09848a301ec20ee37616eacfd7ed963e2d02fdb)

Author SHA1 Message Date
Clayton Coleman b8809dcd67
Add tests for newline in command, arg, and env 2018-07-31 19:22:49 -04:00
Clayton Coleman dca79aaddd
Environment vars with newlines should be indented
Break env var values with newlines so they form a consistent left alignment.
2018-07-31 19:22:49 -04:00
Clayton Coleman 0d8f87a6a3
Break command and args in description by newline
Inline scripts may use newlines in these fields, and properly indenting makes the output more readable:

```
  Command:
    /bin/bash
    -c
    #!/bin/bash
    echo "inline script should be indented"
```
2018-07-31 19:22:49 -04:00
Kubernetes Submit Queue f49708bd49
Merge pull request #66643 from smarterclayton/improve_events
Automatic merge from submit-queue (batch tested with PRs 66445, 66643, 60551). 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>.

Improve the output of `kubectl get events`

Events have long shown the most data of the core objects in their output, but that data is of varying use to a user. Following the principle that events are intended for the system to communicate information back to the user, and that Message is the primary human readable field, this commit alters the default columns to ensure event is shown with the most width given to the message, and all other fields organized by their relevance to the message.

1. Events are no longer sorted in the printer (this was a bug and was broken with paging and server side rendering)
2. Only the last seen, type, reason, kind, and message fields are shown by default, which makes the message prominent
3. Source, subobject, count, and first seen are only shown under `-o wide`
4. The duration fields were changed to be the more precise output introduced for job duration (2-3 sig figs)
5. Prioritized the column order for scanning - when, how important, what kind of error, what kind of object, and the message.
6. Trim trailing newlines on the message.

```release-note
Improved the output of `kubectl get events` to prioritize showing the message, and move some fields to `-o wide`.
```

```
$ kubectl get events --sort-by lastTimestamp
LAST SEEN TYPE      REASON                   KIND                    MESSAGE
16m       Normal    SawCompletedJob          CronJob                 Saw completed job: image-mirror-origin-v3.11-quay-1532581200
16m       Normal    SuccessfulDelete         CronJob                 Deleted job image-mirror-origin-v3.11-quay-1532577600
14m       Normal    Scheduled                Pod                     Successfully assigned 50c42204-9091-11e8-b2a1-0a58ac101869 to origin-ci-ig-n-fqfh
14m       Normal    Pulling                  Pod                     pulling image "docker-registry.default.svc:5000/ci/commenter:latest"
14m       Normal    Created                  Pod                     Created container
14m       Normal    Pulled                   Pod                     Successfully pulled image "docker-registry.default.svc:5000/ci/commenter:latest"
14m       Normal    Started                  Pod                     Started container
14m       Normal    SandboxChanged           Pod                     Pod sandbox changed, it will be killed and re-created.
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m13s     Normal    SuccessfulCreate         ReplicationController   Created pod: tide-30-hmncf
4m13s     Normal    Scheduled                Pod                     Successfully assigned tide-30-hmncf to origin-ci-ig-n-x64l
4m12s     Normal    SuccessfulCreate         ReplicationController   Created pod: console-jenkins-operator-16-dd5k8
4m12s     Normal    SuccessfulCreate         ReplicationController   Created pod: sinker-23-scfmt
```
2018-07-31 15:56:07 -07:00
stewart-yu f1343af5d7 auto-generated file 2018-07-28 07:54:17 +08:00
stewart-yu 55251c716a update the import file for move util/pointer to k8s.io/utils 2018-07-27 19:47:02 +08:00
Clayton Coleman 2f275b72b2
Improve the output of `kubectl get events`
Events have long shown the most data of the core objects in their output, but that data is of varying use
to a user. Following the principle that events are intended for the system to communicate information back
to the user, and that Message is the primary human readable field, this commit alters the default columns
to ensure event is shown with the most width.

1. Events are no longer sorted in the printer (this was a bug and was broken with paging and server side
   rendering)
2. Only the last seen, type, reason, kind, and message fields are shown by default, which makes the
   message prominent
3. Source, subobject, count, and first seen are only shown under `-o wide`
4. The duration fields were changed to be the more precise output introduced for job duration (2-3 sig figs)
2018-07-26 16:12:32 -04:00
Jordan Liggitt bd559e247c
tolerate missing column headers in server-side print output 2018-07-19 20:55:01 -04:00
Jordan Liggitt dc5f615152
Send correct headers for pod printing 2018-07-19 20:55:00 -04:00
Kubernetes Submit Queue 5f55fd21cc
Merge pull request #65351 from dtaniwaki/fix-deletion-timestamp-printing
Automatic merge from submit-queue (batch tested with PRs 65993, 65986, 65351, 65996, 65985). 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>.

Fix DeletionTimestamp printing

**What this PR does / why we need it**:

I found a bug that `ObjectMeta.DeletionTimestamp` is not displayed correctly because it's a future time but it uses the time difference until now. So I fixed it by calculating the time difference from now instead of until now.

Before this fix:
```
Name:                      test-pod-7bd594bd96-hf5kk
Namespace:                 default
Node:                      kube-node-2/10.192.0.4
Start Time:                Fri, 22 Jun 2018 14:57:09 +0900
Labels:                    pod-template-hash=3681506852
                           run=test-pod
Annotations:               <none>
Status:                    Terminating (lasts <invalid>)
Termination Grace Period:  30s
IP:                        10.244.3.5
Controlled By:             ReplicaSet/test-pod-7bd594bd96
Containers:
...
```

After this fix:
```
Name:                      test-pod-7bd594bd96-85cdd
Namespace:                 default
Node:                      kube-node-2/10.192.0.4
Start Time:                Fri, 22 Jun 2018 14:56:44 +0900
Labels:                    pod-template-hash=3681506852
                           run=test-pod
Annotations:               <none>
Status:                    Terminating (lasts 2m)
Termination Grace Period:  123s
IP:                        10.244.3.4
Controlled By:             ReplicaSet/test-pod-7bd594bd96
...
```

Could you consider merging it?
We heavily use preemptible jobs in my company and knowing deletion time and grace periods is really important when jobs trap `SIGTERM` and decide if it should continue to run until the deletion time or just stop immediately.

**Which issue(s) this PR fixes**
N/A

**Special notes for your reviewer**:
N/A

**Release note**:
```release-note
NONE
```
2018-07-09 20:39:10 -07:00
Kubernetes Submit Queue 4d609cea7f
Merge pull request #65780 from liggitt/AddFieldLabelConversionFuncGVK
Automatic merge from submit-queue (batch tested with PRs 65830, 65780, 65961). 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>.

change field selector conversion registration to be strongly typed

the signature of these methods is misleading... they require a group-version-kind

```release-note
NONE
```
2018-07-09 09:35:06 -07:00
Conor Landry d956994857 show pods using pvcs for kubectl describe
sort pods in kubectl describe pvc with user-defined alignment
2018-07-06 10:41:44 -04:00
Daisuke Taniwaki 7cb10e141d
Fix DeletionTimestamp printing 2018-07-04 05:19:34 +09:00
Jordan Liggitt f51ba20cdd
change field selector conversion registration to be strongly typed 2018-07-03 15:47:20 -04:00
David Eads 70417ca150 make template printers a recommended printer 2018-07-03 07:47:17 -04:00
David Eads 52d45cfd4f move template printers to genericclioptions 2018-07-03 07:46:51 -04:00
Kubernetes Submit Queue 10c701c093
Merge pull request #65348 from DylanBLE/dev
Automatic merge from submit-queue (batch tested with PRs 65348, 65599, 65635, 65688, 65691). 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>.

fix typo brance -> brace

**What this PR does / why we need it**:

**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**:
fix typo brance -> brace

**Release note**:

```release-note
None
```
2018-07-02 16:52:06 -07:00
Kubernetes Submit Queue 41c95725b4
Merge pull request #65463 from smarterclayton/jobs_output
Automatic merge from submit-queue (batch tested with PRs 64575, 65120, 65463, 65434, 65522). 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>.

Improve job describe and get output

For get, condense completions and success into a single column, and
print the job duration. Use a new variant of ShortHumanDuration that
shows more significant digits, since duration matters more for jobs.

```
NAME                                   COMPLETIONS   DURATION   AGE
image-mirror-origin-v3.10-1529985600   1/1           47s        42m
image-mirror-origin-v3.11-1529985600   1/1           74s        42m
image-pruner-1529971200                1/1           60m        4h
```

The completions column can be:

```
COMPLETIONS
0/1        # completions nil or 1, succeeded 0
1/1        # completions nil or 1, succeeded 1
0/3        # completions 3, succeeded 1
1/3        # completions 3, succeeded 1
0/1 of 30  # parallelism of 30, completions is nil
```

Update describe to show the completion time and the duration.

```
Start Time:     Mon, 25 Jun 2018 20:00:05 -0400
Completed At:   Mon, 25 Jun 2018 21:00:34 -0400
Duration:       60m
```

This is more useful than the current output:

```
NAME                                   DESIRED   SUCCESSFUL   AGE
image-mirror-origin-v3.10-1529982000   1         1            54m
image-mirror-origin-v3.11-1529982000   1         1            54m
image-pruner-1529971200                1         1            3h
```

```release-note
Improve the display of jobs in `kubectl get` and `kubectl describe` to emphasize progress and duration.
```
2018-06-28 02:20:20 -07:00
wojtekt 0950084137 Autogenerated stuff 2018-06-27 13:31:10 +02:00
wojtekt b95db13ecc Create coordination registry 2018-06-27 13:30:13 +02:00
Clayton Coleman c819a16284
Improve job describe and get output
For get, condense completions and success into a single column, and
print the job duration. Use a new variant of ShortHumanDuration that
shows more significant digits, since duration matters more for jobs.

```
NAME                                   COMPLETIONS   DURATION   AGE
image-mirror-origin-v3.10-1529985600   1/1           47s        42m
image-mirror-origin-v3.11-1529985600   1/1           74s        42m
image-pruner-1529971200                1/1           60m        4h
```

The completions column can be:

```
COMPLETIONS
0/1        # completions nil or 1, succeeded 0
1/1        # completions nil or 1, succeeded 1
0/3        # completions 3, succeeded 1
1/3        # completions 3, succeeded 1
0/1 of 30  # parallelism of 30, completions is nil
```

Update describe to show the completion time and the duration.
2018-06-26 09:37:29 -04:00
Kubernetes Submit Queue ec37c0f643
Merge pull request #65391 from smarterclayton/describe
Automatic merge from submit-queue. 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>.

When splitting `snake_case` words, omit the underscore

While we require camelCase by convention for official APIs, CRDs may use
`snake_case`, and the generic describer prints this as `Snake _ Case`.  We should print `Snake Case`

Prow is impacted by this for the ProwJob CRD:

```
  Decoration _ Config:
    Gcs _ Configuration:
      Bucket:                    origin-ci-test
      Default _ Org:             openshift
      Default _ Repo:            origin
      Path _ Strategy:           single
    Gcs _ Credentials _ Secret:  gcs-publisher-credentials
```

@kubernetes/sig-cli-pr-reviews

```release-note
Using `kubectl describe` on CRDs that use underscores will be prettier.
```
2018-06-24 02:29:30 -07:00
Clayton Coleman 7ae6664171
When splitting `snake_case` words, omit the underscore
While we require camelCase by convention for official APIs, CRDs may use
`snake_case`, and the generic describer prints this as `Snake _ Case`.

Prow is impacted by this for the ProwJob CRD:

```
  Decoration _ Config:
    Gcs _ Configuration:
      Bucket:                    origin-ci-test
      Default _ Org:             openshift
      Default _ Repo:            origin
      Path _ Strategy:           single
    Gcs _ Credentials _ Secret:  gcs-publisher-credentials
```
2018-06-23 00:36:54 -04:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Kubernetes Submit Queue 039a83eef6
Merge pull request #65059 from damemi/iss64983
Automatic merge from submit-queue (batch tested with PRs 61330, 64793, 64675, 65059, 65368). 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>.

marshal bytes to return as string with `kubectl config view -o jsonpath`

**What this PR does / why we need it**:
Certain `byte[]` representations weren't being properly marshalled to strings when calling `kubectl config view` with `-o jsonpath`

**Which issue(s) this PR fixes**:
Fixes https://github.com/kubernetes/kubectl/issues/489

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-06-22 14:52:41 -07:00
Kubernetes Submit Queue b5ea862f52
Merge pull request #65218 from stlaz/sysctls_describe
Automatic merge from submit-queue (batch tested with PRs 65064, 65218, 65260, 65241, 64372). 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 sysctls to the ouput of `describe` on PSPs

**What this PR does / why we need it**:
When promoting the sysctls feature for PSPs, the output of the
`kubectl describe` command was forgotten about. This commit
adds the `AllowedUnsafeSysctls` and `ForbiddenSysctls` fields
to the output of that command.

**Which issue(s) this PR fixes** :
Fixes #65181 

**Release notes**:
```release-note
NONE
```
2018-06-21 21:12:12 -07:00
root 3230974ac2 fix typo brance -> brace 2018-06-22 10:54:41 +08:00
Stanislav Laznicka dd667ec621
Add sysctls to the ouput of `describe` on PSPs
When promoting the sysctls feature for PSPs, the output of the
`kubectl describe` command was forgotten about. This commit
adds the `AllowedUnsafeSysctls` and `ForbiddenSysctls` fields
to the output of that command.
2018-06-20 08:08:40 +02:00
Mike Dame a8b7c94620 marshal bytes to return as string with `kubectl config view -o jsonpath` 2018-06-13 15:25:34 -04:00
Jordan Liggitt 86c2158bb0
Fix up legacy printer table adapter 2018-06-07 13:20:04 -04:00
Cao Shufeng 995c5a07ea fix kubectl -o
Fix kubectl -o error message:
Before this change:
```shell
kubectl get pods -o foo
error: unable to match a printer suitable for the output format "" and the options specified: &get.PrintFlags{JSONYamlPrintFlags:(*genericclioptions.JSONYamlPrintFlags)(0x23aa610), NamePrintFlags:(*genericclioptions.NamePrintFlags)(0xc42058b4e0), TemplateFlags:(*printers.KubeTemplatePrintFlags)(0xc4206765e0), CustomColumnsFlags:(*printers.CustomColumnsPrintFlags)(0xc420676620), HumanReadableFlags:(*get.HumanPrintFlags)(0xc4204eb180), NoHeaders:(*bool)(0xc4206fefbc), OutputFormat:(*string)(0xc42058b4d0)}
```

After this change:
```shell
Kubectl get pods -o foo
error: unable to match a printer suitable for the output format "aaa", allowed formats are: custom-columns,custom-columns-file,go-template,go-template-file,json,jsonpath,jsonpath-file,name,template,templatefile,wide,yaml
```
2018-06-05 19:49:07 +08:00
Davanum Srinivas 5fa8a2412d API updates for Cinder Volumes to support for user specified Secrets in the future 2018-06-02 22:16:50 -04:00
Dr. Stefan Schimanski 7066141277 printers: add deepcopy tests to generated tables 2018-06-02 09:56:15 +00:00
Dr. Stefan Schimanski ebbfaf3869 printers: fix json types – int64 is only allowed integer
We have the invariant in apimachinery that all integers in JSON are int64.
We panic on other types on deepcopy and possibly at other occasions.
2018-06-02 09:43:20 +00:00
Anthony Yeh 1c531fc970
kubectl: Use apps/v1 Deployment/ReplicaSet.
This is necessary since kubectl shares code with the controllers,
and the controllers have been updated to use apps/v1.
2018-05-22 13:43:06 -07:00
Kubernetes Submit Queue 2ff0bc2b8a
Merge pull request #63967 from deads2k/rbac-06-external
Automatic merge from submit-queue (batch tested with PRs 62025, 63851, 64077, 63967, 63991). 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>.

switch rbac to external

The overall trajectory of the project is towards external types.  Having all helpers agree on the version they operate on makes life much easier.  We've already written one RBAC controller (role aggregation) and more may follow.  `v1` has been around for a while now and we know that any future changes have to reliably roundtrip through it.  This pull switches all the core helpers over to use the external types.

@kubernetes/sig-auth-pr-reviews 

```release-note
`kubectl auth reconcile` only works with rbac.v1
```
2018-05-22 08:40:26 -07:00
David Eads 092714ea0f switch rbac to external 2018-05-22 08:17:05 -04:00
juanvallejo d1603c9560 move PrintOptions to genericclioptions 2018-05-21 14:59:41 -04:00
Kubernetes Submit Queue a915811a98
Merge pull request #63776 from wgliang/master.test-printers
Automatic merge from submit-queue (batch tested with PRs 63770, 63776, 64001, 64028, 63984). 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>.

use subtest for table units (pkg/printers)

**What this PR does / why we need it**:

Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Many table-driven tests in pkg/kubectl are not using this feature.

/kind cleanup

Further reading: [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)

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

**Release note**:

```release-note
NONE
```
2018-05-19 02:11:30 -07:00
David Eads 420dd9bf66 move type setting into an optional layer above normal printing 2018-05-17 17:22:12 -04:00
David Eads 304bce3cdf add protection for missing apiversion so we never serialize a bad object 2018-05-17 17:20:54 -04:00
juanvallejo 0164605d31 remove versioned printer 2018-05-17 17:20:54 -04:00
Kubernetes Submit Queue 64bb688ece
Merge pull request #63844 from tossmilestone/add-statefulset-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.
```
2018-05-17 13:40:28 -07:00
He Xiaoxi 2fd73130db Add strategy description for 'kubectl describe sts' command 2018-05-17 10:29:28 +08:00
David Eads dfa5bfd39f remove decoder from name printing 2018-05-14 15:55:38 -04:00
xuzhonghu 7e4014e02b remove unused PrintFlags.Scheme 2018-05-14 20:49:19 +08:00
Guoliang Wang ae4c9d71c1 use subtest for table units (pkg/printers) 2018-05-14 15:11:48 +08:00
Kubernetes Submit Queue 92ba95c39c
Merge pull request #63446 from deads2k/client-08-remove-old
Automatic merge from submit-queue (batch tested with PRs 63367, 63718, 63446, 63723, 63720). 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>.

finish new dynamic client and deprecate old dynamic client

Builds on a couple other pulls.  This completes the transition to the new dynamic client.

@kubernetes/sig-api-machinery-pr-reviews 
@caesarxuchao @sttts 

```release-note
The old dynamic client has been replaced by a new one.  The previous dynamic client will exist for one release in `client-go/deprecated-dynamic`.  Switch as soon as possible.
```
2018-05-11 14:49:16 -07:00
juanvallejo b5f6d834fc fail printing on internal obj 2018-05-11 14:54:37 -04:00
David Eads fd044d152e fix dynamic client name 2018-05-11 13:12:09 -04:00
David Eads 1fd4149ed4 update describer to use dynamic client 2018-05-11 07:59:08 -04:00
Kubernetes Submit Queue 7eb88f11d2
Merge pull request #59727 from wgliang/master.time
Automatic merge from submit-queue. 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>.

should use time.Since instead of time.Now().Sub

**What this PR does / why we need it**:
should use time.Since instead of time.Now().Sub

**Special notes for your reviewer**:
2018-05-10 20:29:40 -07:00
juanvallejo 40e52bf07d remove legacyscheme dep from printFlags 2018-05-10 14:51:12 -04:00
David Eads c5445d3c56 simplify api registration 2018-05-08 18:33:50 -04:00
juanvallejo a74b28d961 rm GetStandardPrinter 2018-05-07 15:37:55 -04:00
juanvallejo 5a34e4f594 remove printer helpers 2018-05-07 15:37:55 -04:00
Kubernetes Submit Queue d4b4f5aa8d
Merge pull request #63438 from php-coder/psp_unix_user_and_group_id
Automatic merge from submit-queue. 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>.

Use single struct in internal type to reduce difference with external type

**What this PR does / why we need it**:
This PR reduces the differences between internal and external types by removing leftovers after revert of one of the changes.

**Special notes for your reviewer**:
We had `IDRange` in both types prior 9440a68744 commit (https://github.com/kubernetes/kubernetes/pull/44714) that splitted it into `UserIDRange`/`GroupIDRange`. Later, in c91a12d205 commit (https://github.com/kubernetes/kubernetes/pull/47824) we had to revert these changes because they broke backward compatibility but `UserIDRange`/`GroupIDRange` structs were left in the internal type.
2018-05-04 11:43:29 -07:00
Kubernetes Submit Queue 484f62a568
Merge pull request #63333 from deads2k/api-14-snip
Automatic merge from submit-queue (batch tested with PRs 63421, 63432, 63333). 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>.

update tests to be specific about the versions they are testing

When setting up tests, you want to rely on your own scheme.  This eliminates coupling to floating versions which gives unnecessary flexibility in most cases and prevents testing all the versions you need.

@liggitt  scrubs unnecessary deps.

```release-note
NONE
```
2018-05-04 10:52:10 -07:00
Slava Semushin f49a0fbd5f Replace UserIDRange/GroupIDRange by IDRange in internal type to reduce difference with external type.
We had IDRange in both types prior 9440a68744 commit that splitted it
into UserIDRange/GroupIDRange. Later, in c91a12d205 commit we had to
revert this changes because they broke backward compatibility but
UserIDRange/GroupIDRange struct left in the internal type.

This commit removes these leftovers and reduces the differences
between internal and external types.
2018-05-04 18:31:42 +02:00
David Eads e1fca70506 slim down printer interface 2018-05-04 11:15:35 -04:00
Kubernetes Submit Queue b52ebfa28e
Merge pull request #63312 from deads2k/cli-44-encoder
Automatic merge from submit-queue. 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>.

remove unnecessary encoder

Followups to https://github.com/kubernetes/kubernetes/pull/63105
2018-05-03 16:11:17 -07:00
David Eads 9a48066749 update restmapping to indicate fully qualified resource 2018-05-01 16:34:49 -04:00
David Eads 94e3d94d67 update tests to be specific about the versions they are testing instead of floating 2018-05-01 13:18:41 -04:00
David Eads 04384481cd remove unnecessary encoder 2018-04-30 14:55:15 -04:00
David Eads 6900f8856f rest mappings cannot logically be object converters 2018-04-26 12:47:25 -04:00
David Eads a89291a5de stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
Kubernetes Submit Queue acbccfba84
Merge pull request #62820 from juanvallejo/jvallejo/wire-more-print-flags
Automatic merge from submit-queue. 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>.

wire printflags through additional cmds

**Release note**:
```release-note
NONE
```

Adds PrintFlag pattern to more commands.

cc @deads2k @soltysh
2018-04-26 02:20:34 -07:00
juanvallejo ac6ca38dd7 report outputFormat in PrintFlags err 2018-04-25 16:35:56 -04:00
juanvallejo 27bd4ded04 wire printflags through additional cmds 2018-04-25 16:07:32 -04:00
juanvallejo 191a48f4c3 wire PrintFlags through get cmd 2018-04-25 15:02:48 -04:00
juanvallejo df6a7ea654 move "get" cmd pieces to cmd/get 2018-04-25 14:58:12 -04:00
Kubernetes Submit Queue df489968b7
Merge pull request #62877 from deads2k/cli-34-describer
Automatic merge from submit-queue (batch tested with PRs 62982, 63075, 63067, 62877, 63141). 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>.

make describers more generic from the CLI

I've made this change very small so the intent and explanation make sense to people.

Clients are not generic.  Client**Configs** are generic.  We faced this distinction in the apiserver and it took us a little to hurdle it.  When you try to provide a generic example or function, you need to provide Client**Config**, not a kube clientset.  The reason is that the code you're calling may have generated their own clientset, may want to use a dynamic one, or may want to a simple restclient.  As we seek to make `kubectl` primitives more generally applicable, this is an example we'll want to follow.  I suspect we'll be making more changes along these veins as we tease out the generic pieces of `kubectl ` to make a friendly CLI library.


@kubernetes/sig-cli-maintainers 

/hold

Holding for a few days to make sure that people have time to read and digest.

```release-note
NONE
```
2018-04-25 11:53:21 -07:00
David Eads e7fbbe0e3c eliminate indirection from type registration 2018-04-25 09:02:31 -04:00
Kubernetes Submit Queue 9baf337cf3
Merge pull request #63084 from mikedanese/ctx
Automatic merge from submit-queue (batch tested with PRs 59220, 62927, 63084, 63090, 62284). 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>.

replace request.Context with context.Context

Followup on https://github.com/kubernetes/kubernetes/pull/62810

cc @liggitt @kubernetes/sig-api-machinery-pr-reviews 

```release-note
NONE
```
2018-04-24 19:01:17 -07:00
Mike Danese 54fd2aaefd replace request.Context with context.Context 2018-04-24 08:59:00 -07:00
Kubernetes Submit Queue 4692a6bf2e
Merge pull request #62784 from hanxiaoshuai/bugfix0418
Automatic merge from submit-queue. 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>.

we should use Infof when we are using format string

**What this PR does / why we need it**:
we should use Infof when we are using format string.
**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**:

**Release note**:

```release-note
NONE
```
2018-04-23 17:45:20 -07:00
Kubernetes Submit Queue 9031f9a8ca
Merge pull request #62642 from ceshihao/kubectl_get_pod_status
Automatic merge from submit-queue (batch tested with PRs 62642, 62855, 62487, 62858, 62873). 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>.

Make pod status to Running if some are Running and some are Completed

**What this PR does / why we need it**:
Make pod status to Running if some are Running and some are Completed

**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 #62588

**Special notes for your reviewer**:
Only Set Pod status to Completed when no other reason, no Running container and only Completed containers.

Set status to Running if some are Running and some are Completed

**Release note**:

```release-note
Set pod status to "Running" if there is at least one container still reporting as "Running" status and others are "Completed".
```
2018-04-19 15:54:16 -07:00
David Eads 66a95a8f3e make describers more generic from the CLI 2018-04-19 16:22:42 -04:00
ceshihao 6b94e872c6 Make pod status to "Running" if there is at least one container still reporting as "Running" status 2018-04-19 14:24:18 +08:00
Kubernetes Submit Queue 44ede98e94
Merge pull request #61689 from Lion-Wei/kubectl-np
Automatic merge from submit-queue (batch tested with PRs 62510, 61689). 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>.

Extend kubectl describe for networkPolicy

**What this PR does / why we need it**:
Recently `networkpolicy` was allowed podSelector and namespaceSelector to be specified together in a NetworkPolicyPeer, so we need to extend `kubectl describe` for networkpolicy.

**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 kubernetes/kubectl#376

**Special notes for your reviewer**:
Here is the example output of `kubectl describe networkpolicies`:
NetworkPolicy file:
```yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: test-network-policy
  namespace: default
spec:
  podSelector:
    matchLabels:
      role: db
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          project: myproject
      podSelector:
        matchLabels:
          role: frontend
    ports:
    - protocol: TCP
      port: 6379
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          project: myproject
      podSelector:
        matchLabels:
          role: frontend
    ports:
    - protocol: TCP
      port: 6379
```
describe:
```shell
# ./kubectl describe netpol test-network-policy
Name:         test-network-policy
Namespace:    default
Created on:   2018-03-26 15:20:11 +0800 CST
Labels:       <none>
Annotations:  <none>
Spec:
  PodSelector:     role=db
  Allowing ingress traffic:
    To Port: 6379/TCP
    From NamespaceSelector: project=myproject
         PodSelector: role=frontend
  Allowing egress traffic:
    To Port: 6379/TCP
    To NamespaceSelector: project=myproject
       PodSelector: role=frontend
  Policy Types: Ingress, Egress

```

**Release note**:
```release-note
NONE
```
2018-04-18 19:36:11 -07:00
Mike Danese f427531179 boring 2018-04-18 09:55:57 -07:00
Kubernetes Submit Queue 87caa938b7
Merge pull request #62744 from liggitt/describe-cronjob
Automatic merge from submit-queue (batch tested with PRs 60201, 62744). 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>.

Fix kubectl describe cronjob

CronJob describer was attempting to use the internal batch clientset, which speaks to the batch/v1 API group. CronJobs do not exist in that API group.
2018-04-18 07:58:19 -07:00
hangaoshuai 50af9dea0c we should use Infof when we are using format string 2018-04-18 20:12:42 +08:00
Jordan Liggitt d07c417b18
Fix kubectl describe cronjob 2018-04-17 14:47:55 -04:00
juanvallejo 8a7b2fdda3
begin wiring printopts through complete commands 2018-04-13 11:50:54 -04:00
Slava Semushin 8a7d5707d5 PSP: move internal types from extensions to policy. 2018-04-11 18:35:09 +02:00
Wang Guoliang 89669283fe should use time.Since instead of time.Now().Sub 2018-04-10 12:05:51 +08:00
Lion-Wei 69ea7722c8 update network policy describe 2018-04-09 19:12:14 +08:00
juanvallejo 2a202cf49a
update PrintFlags#Complete to receive string template 2018-04-06 16:44:40 -04:00
Kubernetes Submit Queue 57d723ddc2
Merge pull request #62139 from juanvallejo/jvallejo/begin-wiring-print-flags
Automatic merge from submit-queue (batch tested with PRs 62063, 62169, 62155, 62139, 61445). 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>.

begin wiring printflags through set cmds

**Release note**:
```release-note
NONE
```

Begin wiring PrintFlags struct through commands

cc @deads2k @soltysh
2018-04-05 17:42:10 -07:00
juanvallejo 4b4b6c879a
begin wiring printflags through set cmds 2018-04-05 16:34:51 -04:00
Kubernetes Submit Queue 9f4b851e91
Merge pull request #56629 from luksa/fix_custom_column_alignment
Automatic merge from submit-queue. 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>.

Fix bad column alignment when using custom columns from OpenAPI schema

Columns printed by `kubectl get` weren't aligned properly when they were coming from the OpenAPI schema. 

This was caused by `CustomColumnPrinter.PrintObj`, which was creating a new `tabwriter.Writer` instead of re-using the tabwriter received through the `out` method parameter (basically, a tabwriter was writing to another tabwriter). Because the PrintObj flushed the tabwriter after writing each individual line, the column widths would reset.

**What this PR does / why we need it**:
This PR fixes the bad column alignment.

**Which issue(s) this PR fixes** 
Fixes #56282 

**Special notes for your reviewer**:
I've aligned how `CustomColumnPrinter.PrintObj` handles tabwriter with how `HumanReadablePrinter.PrintObj` does it (see https://github.com/kubernetes/kubernetes/blob/master/pkg/printers/humanreadable.go#L299-L303)

**Release note**:
```release-note
Fixed column alignment when kubectl get is used with custom columns from OpenAPI schema
```
2018-04-05 09:56:41 -07:00
juanvallejo a3a430ce01
wire through humanreadable flags 2018-04-03 13:59:35 -04:00
Jordan Liggitt 3b8a570437
Restore show-kind function when printing multiple kinds 2018-04-01 00:24:25 -04:00
Kubernetes Submit Queue ea2bd22367
Merge pull request #61304 from juanvallejo/add-template-printer-flags
Automatic merge from submit-queue (batch tested with PRs 57658, 61304, 61560, 61859, 61870). 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>.

wire through template PrintFlags

**Release note**:
```release-note
NONE
```

Begin implementing pieces needed to retrieve `go-template`, `jsonpath` printers from a set of flags.
Proposal: https://docs.google.com/document/d/19ZZFVe9oD1KQmk5uExggRWtRl_hKGfYnBXvHZJlgEro/edit#heading=h.pnvbfi14v4zz

cc @soltysh @deads2k @pwittrock
2018-03-29 15:03:06 -07:00
Kubernetes Submit Queue 831198edbc
Merge pull request #61808 from liggitt/dry-run-printing
Automatic merge from submit-queue (batch tested with PRs 61790, 61808, 60339, 61615, 61757). 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>.

Ensure -o yaml populates kind/apiVersion

Fixes #61780 

```release-note
kubectl: fixes issue with `-o yaml` and `-o json` omitting kind and apiVersion when used with `--dry-run`
```
2018-03-28 09:39:12 -07:00
Jordan Liggitt a174d7a2de
Ensure -o yaml populates kind/apiVersion 2018-03-27 23:27:40 -04:00
xiangpengzhao bd02b49c20 Display extended resources in node allocated resources 2018-03-28 10:19:15 +08:00
juanvallejo ec672ca279
wire through template PrintFlags 2018-03-27 18:11:01 -04:00
Kubernetes Submit Queue 99fb4166d9
Merge pull request #59609 from zhangxiaoyu-zidif/add-rs-in-hpa-describe
Automatic merge from submit-queue (batch tested with PRs 61434, 61501, 59609, 61467, 61531). 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 others's status in hpa describe

**What this PR does / why we need it**:
Add other status in HPA describe

- rs
- deployment

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

**Release note**:

```release-note
Add all kinds of resource objects' statuses in HPA description.
```
2018-03-26 19:52:10 -07:00