Files
kubernetes/pkg/kubectl
k8s-merge-robot 03fc51f74f Merge pull request #26046 from timoreimann/stabilize-map-order-in-kubectl-describe
Automatic merge from submit-queue

Stabilize map order in kubectl describe

Refs #25251.

Add `SortedResourceNames()` methods to map type aliases in order to achieve stable output order for `kubectl` descriptors.

This affects QoS classes, resource limits, and resource requests.

A few remarks:

1. I couldn't find map usages for described fields other than the ones mentioned above. Then again, I failed to identify those programmatically/systematically. Pointers given, I'd be happy to cover any gaps within this PR or along additional ones.
1. It's somewhat difficult to deterministically test a function that brings reliable ordering to Go maps due to its randomizing nature. None of the possibilities I came up with (rely a "probabilistic testing" against repeatedly created maps, add complexity through additional interfaces) seemed very appealing to me, so I went with testing my `sort.Interface` implementation and the changed logic in `kubectl.describeContainers()`.
1. It's apparently not possible to implement a single function that sorts any map's keys generically in Go without producing lots of boilerplate: a `map[<key type>]interface{}` is different from any other map type and thus requires explicit iteration on the caller site to convert back and forth. Unfortunately, this makes it hard to completely avoid code/test duplication.

Please let me know what you think.
2016-05-28 10:49:57 -07:00
..
2016-05-13 12:41:40 -07:00
2016-05-12 00:07:07 -04:00
2016-05-07 10:06:13 -04:00
2016-05-10 09:55:14 -07:00
2016-05-10 13:49:39 -07:00
2016-05-19 08:41:43 -04:00
2016-05-21 15:48:40 +02:00
2016-04-29 17:12:10 -04:00
2016-05-12 00:07:07 -04:00
2016-04-29 17:12:10 -04:00
2016-04-29 17:12:10 -04:00