Sort yaml/json fields more helpfully when printing objects #10311
Closed
Description
When I do kubectl get foo/bar -o yaml
, I see things like this:
apiVersion: v1beta3
foo: blah <------------- why is this before kind and metadata?
kind: bar
metadata:
creationTimestamp: 2015-06-24T21:09:17Z
name: myregistrykey <----- why isn't this first because it is the most important metadata.
namespace: default
resourceVersion: "1497"
selfLink: /api/v1beta3/namespaces/default/secrets/myregistrykey
uid: 46703fde-1ab5-11e5-b558-42010af0cf71
zlist:
- property: foo
name: bar <---------- why isn't name always first?
It appears that tags are sorted alphabetically.
I'd rather always see fields that are in all objects at the top, so apiVersion
, kind
, and metadata
should come before any kind-specific fields. (In the above example, field foo
comes before metadata
).
And I'd rather see name
as the first property in a list for which name is the merge key.
Maybe this is just my opinion.