kubernetes/pkg/kubectl/cmd
Kubernetes Submit Queue c682496197
Merge pull request #67211 from juanvallejo/jvallejo/prototype-sorter
Automatic merge from submit-queue (batch tested with PRs 68051, 68130, 67211, 68065, 68117). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Update `kubectl get` sorter to deal with server-side printing

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

### Why?

Currently, we default to non-server-side printing when sorting items in `kubectl get`. This means that instead of taking advantage of having the server tell `kubectl` how to display information, `kubectl` falls back to using hardcoded resource types to figure out how to print its output. This does not really work with resources that `kubectl` does not know about, and it goes against our goal of snipping any dependencies that `kubectl` has on the core repo.

This patch adds a sorter capable of dealing with Table objects sent by the server when using "server-side printing".

A few things left to take care of:

- ~~[ ] When printing `all` resources, this implementation does not handle sorting every single Table object, but rather _only_ the rows in each object. As a result, output will contain sorted resources of the same _kind_, but the overall list of mixed resources will _not_ itself be sorted. Example:~~

```bash
$ kubectl get all --sort-by .metadata.name
NAME            READY     STATUS    RESTARTS   AGE
# pods here will be sorted:
pod/bar         0/2       Pending   0          31m
pod/foo         1/1       Running   0          37m

NAME                        DESIRED   CURRENT   READY     AGE
# replication controllers here will be sorted as well:
replicationcontroller/baz   1         1         1         37m
replicationcontroller/buz   1         1         1         37m

# ... but the overall mixed list of rc's and pods will not be sorted
```
This occurs because each Table object received from the server contains all rows for that resource _kind_. We would need a way to build an ambiguous Table object containing all rows for all objects regardless of their type to have a fully sorted mixed-object output.

- [ ] handle sorting by column-names, rather than _only_ with jsonpaths (Tracked in https://github.com/kubernetes/kubernetes/issues/68027)

cc @soltysh @kubernetes/sig-cli-maintainers @seans3 @mengqiy
2018-08-31 15:32:40 -07:00
..
auth Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
config Merge pull request #66980 from flimzy/typo 2018-08-23 02:44:43 -07:00
create Get rid of argsLenAtDash in create job 2018-08-22 15:23:15 +02:00
get add prototype sorting for table rows 2018-08-30 16:09:05 -04:00
rollout Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
scalejob moved dependency within kubernetes core to staging 2018-08-10 13:45:17 -07:00
set Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
templates clean unused function 2018-07-16 15:16:32 +08:00
testdata K8s SCTP support implementation for the first pull request 2018-08-27 05:56:27 +00:00
testing Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
util Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
wait Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
alpha.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
annotate.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
annotate_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apiresources.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apiversions.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apply.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apply_edit_last_applied.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apply_set_last_applied.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apply_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
apply_view_last_applied.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
attach.go Merge pull request #67615 from rphillips/fixes/attach_func_initializer 2018-08-22 07:32:57 -07:00
attach_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
autoscale.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
BUILD update bazel 2018-08-30 00:27:18 +08:00
certificates.go use CertificatesV1beta1() instead of deprecated Certificates() 2018-08-30 00:27:17 +08:00
clusterinfo.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
clusterinfo_dump.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
clusterinfo_dump_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
cmd.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
cmd_printing_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
cmd_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
completion.go improve kubectl completion help 2018-06-21 14:42:33 +08:00
convert.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
convert_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
cp.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
cp_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
delete.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
delete_flags.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
delete_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
describe.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
describe_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
diff.go diff: Fix crash when remote object doesn't exist 2018-08-22 06:36:29 -07:00
diff_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
drain.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
drain_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
edit.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
edit_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
exec.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
exec_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
explain.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
expose.go K8s SCTP support implementation for the first pull request 2018-08-27 05:56:27 +00:00
expose_test.go K8s SCTP support implementation for the first pull request 2018-08-27 05:56:27 +00:00
help.go some code change 2017-12-25 16:23:38 +08:00
label.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
label_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
logs.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
logs_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
options.go move i18n to kubectl/util 2017-08-16 12:27:36 -07:00
patch.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
patch_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
plugin.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
portforward.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
portforward_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
proxy.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
replace.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
replace_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
rollingupdate.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
rollingupdate_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
run.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
run_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
scale.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
taint.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
taint_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top_node.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top_node_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top_pod.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top_pod_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
top_test.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
version.go Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00