• Kubernetes Submit Queue's avatar
    Merge pull request #67211 from juanvallejo/jvallejo/prototype-sorter · c6824961
    Kubernetes Submit Queue authored
    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
    c6824961
Name
Last commit
Last update
..
boilerplate Loading commit data...
e2e-internal Loading commit data...
gen-swagger-doc Loading commit data...
jenkins Loading commit data...
lib Loading commit data...
make-rules Loading commit data...
testdata Loading commit data...
verify-flags Loading commit data...
.golint_failures Loading commit data...
.spelling_failures Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
autogenerated_placeholder.txt Loading commit data...
benchmark-go.sh Loading commit data...
build-cross.sh Loading commit data...
build-go.sh Loading commit data...
build-ui.sh Loading commit data...
cherry_pick_pull.sh Loading commit data...
dev-build-and-push.sh Loading commit data...
dev-build-and-up.sh Loading commit data...
dev-push-hyperkube.sh Loading commit data...
e2e-node-test.sh Loading commit data...
e2e.go Loading commit data...
e2e_test.go Loading commit data...
generate-bindata.sh Loading commit data...
generate-docs.sh Loading commit data...
get-build.sh Loading commit data...
ginkgo-e2e.sh Loading commit data...
godep-restore.sh Loading commit data...
godep-save.sh Loading commit data...
grab-profiles.sh Loading commit data...
import-restrictions.yaml Loading commit data...
install-etcd.sh Loading commit data...
list-feature-tests.sh Loading commit data...
local-up-cluster.sh Loading commit data...
print-workspace-status.sh Loading commit data...
run-in-gopath.sh Loading commit data...
test-go.sh Loading commit data...
test-integration.sh Loading commit data...
test-update-storage-objects.sh Loading commit data...
update-all.sh Loading commit data...
update-api-reference-docs.sh Loading commit data...
update-bazel.sh Loading commit data...
update-cloudprovider-gce.sh Loading commit data...
update-codegen.sh Loading commit data...
update-generated-device-plugin-dockerized.sh Loading commit data...
update-generated-device-plugin.sh Loading commit data...
update-generated-docs.sh Loading commit data...
update-generated-kms-dockerized.sh Loading commit data...
update-generated-kms.sh Loading commit data...
update-generated-kubelet-plugin-registration-dockerized.sh Loading commit data...
update-generated-kubelet-plugin-registration.sh Loading commit data...
update-generated-protobuf-dockerized.sh Loading commit data...
update-generated-protobuf.sh Loading commit data...
update-generated-runtime-dockerized.sh Loading commit data...
update-generated-runtime.sh Loading commit data...
update-generated-swagger-docs.sh Loading commit data...
update-godep-licenses.sh Loading commit data...
update-gofmt.sh Loading commit data...
update-openapi-spec.sh Loading commit data...
update-staging-godeps-dockerized.sh Loading commit data...
update-staging-godeps.sh Loading commit data...
update-swagger-spec.sh Loading commit data...
update-translations.sh Loading commit data...
update-workspace-mirror.sh Loading commit data...
update_owners.py Loading commit data...
verify-all.sh Loading commit data...
verify-api-groups.sh Loading commit data...
verify-api-reference-docs.sh Loading commit data...
verify-bazel.sh Loading commit data...
verify-boilerplate.sh Loading commit data...
verify-cli-conventions.sh Loading commit data...
verify-cloudprovider-gce.sh Loading commit data...
verify-codegen.sh Loading commit data...
verify-description.sh Loading commit data...
verify-flags-underscore.py Loading commit data...
verify-generated-device-plugin.sh Loading commit data...
verify-generated-docs.sh Loading commit data...
verify-generated-files-remake.sh Loading commit data...
verify-generated-files.sh Loading commit data...
verify-generated-kms.sh Loading commit data...
verify-generated-kubelet-plugin-registration.sh Loading commit data...
verify-generated-protobuf.sh Loading commit data...
verify-generated-runtime.sh Loading commit data...
verify-generated-swagger-docs.sh Loading commit data...
verify-godep-licenses.sh Loading commit data...
verify-godeps.sh Loading commit data...
verify-gofmt.sh Loading commit data...
verify-golint.sh Loading commit data...
verify-govet.sh Loading commit data...
verify-import-boss.sh Loading commit data...
verify-imports.sh Loading commit data...
verify-linkcheck.sh Loading commit data...
verify-no-vendor-cycles.sh Loading commit data...
verify-openapi-spec.sh Loading commit data...
verify-pkg-names.sh Loading commit data...
verify-readonly-packages.sh Loading commit data...
verify-spelling.sh Loading commit data...
verify-staging-godeps.sh Loading commit data...
verify-staging-meta-files.sh Loading commit data...
verify-swagger-spec.sh Loading commit data...
verify-symbols.sh Loading commit data...
verify-test-images.sh Loading commit data...
verify-test-owners.sh Loading commit data...
verify-typecheck.sh Loading commit data...