-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize describer outputs #25251
Comments
/cc @jlowdermilk |
This is due to random map order. Agree that stable order would be useful. |
Agreed - all describers should be stable order and we should probably make sure we educate reviewers to look for that. |
Among other things, all maps need to be sorted. |
Unless someone has already started to work on this, I'd like to take a stab. |
@timoreimann Have you started working on this? If not I would like to take it over |
@Gitfred I did actually. I plan to push out a PR over the weekend. |
…ectl-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.
@roberthbailey @bgrant0607 @smarterclayton @jlowdermilk @derekwaynecarr fixed order output for pod descriptions. Do you know of any other describers that use maps as well? A quick glance on my end didn't yield anything but maybe I missed some. |
@timoreimann Maps in the API are: labels, annotations, resources, selectors, Secret and ConfigMap data, Flex volume source options |
@bgrant0607 thanks. I'll go over the list and see what still needs to be done. Please let me know if you have any preference towards either tracking everything as part of this issue or a new one (that I can create) instead. |
I think this one issue is fine to track. The current work handled resources. If you want to put a task list on the issue to track that is fine too. |
@bgrant0607 @derekwaynecarr I updated the issue title and description to better reflect the broader scope of the ticket. Will continue to work on the individual bits and pieces. |
I fixed two bugs that relate to this (#32229, #35112), I think we need a better contract. I am looking at To illustrate, the structs could look something like these: type Section struct {
Name string
}
type LineDescriptions struct {
Tabs int32
Data map[string]string
}
type Table struct {
Head []string
Data [][]string
} Let's also consider more convertable output formats, I am thinking of markdown or something similar (of course we don't want YAML, we already have that), it'd help a lot for folks who want to work on IDE integrations and other similar things (I've started more specific discussion in #37576). |
Since we're going to move this to the server side, it would be better not
to dig into this until we settle on that design.
…On Mon, Nov 28, 2016 at 5:24 PM, Ilya Dmitrichenko ***@***.*** > wrote:
I fixed two bugs that relate to this (#32229
<#32229>, #35112
<#35112>), I think we need a
better contract.
I am looking at pkg/kubectl/describe.go and, and I feel like it can be
made more elegant with good use of text/template, or maybe be just a few
extra structs could work better. It's just a massive set of special cases
right now, with formatting characters everywhere (which seem fairly
consistent, but you can never tell 100%).
To illustrate, the structs could look something like these:
type Section struct {
Name string
}
type LineDescriptions struct {
Tabs int32
Data map[string]string
}
type Table struct {
Head []string
Data [][]string
}
Let's also consider more convertable output formats, I am thinking of
markdown or something similar (of course we don't want YAML, we already
have that), it'd help a lot for folks who want to work on IDE integrations
and other similar things (I've started more specific discussion in #37576
<#37576>).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25251 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pxTkJiRQ2S2aIJp-FrR6GFhvDnoCks5rC1S3gaJpZM4IYr4_>
.
|
@smarterclayton you mean this proposal #29472? |
That was the rough draft yes - it needs more detail on describe.
…On Wed, Nov 30, 2016 at 7:59 AM, TonyAdo ***@***.***> wrote:
@smarterclayton <https://github.com/smarterclayton> you mean this
proposal #29472 <#29472>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25251 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p2OXfoRyVIkYCAI1Y7WQTylK-U8lks5rDXMsgaJpZM4IYr4_>
.
|
Issues go stale after 30d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Just picked up this issue again. @smarterclayton is it okay to continue working on the describer output? or is that move to the server side still ongoing? |
We’re going to discuss it again the first week in January. Probably best to wait until then |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten
…On Fri, 5 Jul 2019, 2:43 am fejta-bot, ***@***.***> wrote:
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta
<https://github.com/fejta>.
/lifecycle rotten
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#25251?email_source=notifications&email_token=AAB5MS3QW4XDBCPUHW5RFQLP52RLNA5CNFSM4CDCXY72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZIKULQ#issuecomment-508602926>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAB5MS3RJSE2I6OFHPVPOELP52RLNANCNFSM4CDCXY7Q>
.
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Hey, @timoreimann @errordeveloper This one has been open for some time. Is there anything that is needed? |
@McCoyAle tbh, I haven't worked on this one so long that I'm not sure whether it's still relevant. Do you possibly know? If not and you happen to have a moment to verify whether output ordering is still an issue, I'd love to hear about it. |
for now: /remove-lifecycle rotten |
/remove-lifecycle rotten |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Bug 1854312: 4.4: UPSTREAM: 92014: CSI: Modify VolumeAttachment check to use Informer/cache Origin-commit: 65d455ba14320a3e1270c2d304a0007de3045177
All describers should exhibit a stable output behavior; that is, the output should only change if the state of the underlying object changes. Specifically, we should make sure that all iterations over maps (which Go randomizes) are always carried out in a stable, deterministic fashion.
TODO list (and related object(s)):
(Original issue descriptions:
kubectl describe pod <some pod>
enumerates container resources for various aspects, namely CPU and memory for QoS tiers, limits, and requests at this moment. When invoking the command multiple times, one can see that the order is not stable: Sometimes, CPU is listed before memory, and other times it's just vice versa. It's not stable across resource types either (i.e., QoS tiers may show CPU first while limits doesn't).For certain use cases (such as when passing the command to
watch -1
), a stable order would be helpful to minimize distraction from such "irrelevant" output changes.Happy to work on a PR if folks agree.)
The text was updated successfully, but these errors were encountered: