-
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
REST api - container status is represented in an inconvenient fashion #6979
Comments
We use that pattern to implement "oneof" on the spec side in several places (e.g., VolumeSource), but this may be the only instance of it on the status side:
I can see how that would be problematic. Would a field indicating the state help, like a tagged union? |
@bgrant0607 can you give an example of what you meant it should look like? From my side I meant something like the below. |
I was suggesting just adding a type field to indicate which map fields can be expected to be populated.
|
@bgrant0607 |
@bgrant0607 consider that even given the 'type', clients will need to hardcode the logic to search for specific attributes per type. |
I'd like to flatten them, I think it would be a better API. I don't know Embedding does not work: http://play.golang.org/p/AWmxc9LYOF Manual-assist decode is not too bad but, well, manually maintained: Reflection could work, but I can't find the bug in this: On Tue, Apr 21, 2015 at 1:41 AM, abonas notifications@github.com wrote:
|
@thockin , I'm still looking at all the info you provided here (such a detailed comment - thanks!) |
Brian, Dawn If we're willing to accept some custom JSON code, this pattern is pretty http://play.golang.org/p/LYO6u0D1A9 On Wed, Apr 22, 2015 at 1:28 AM, abonas notifications@github.com wrote:
|
@thockin, any verdict on how and when this will be fixed? |
No verdict yet. The bar is pretty high for API changes between now and On Tue, Apr 28, 2015 at 4:46 AM, abonas notifications@github.com wrote:
|
We don't have time to change this now, and don't have a good solution. At most, I suggest we add the type field. |
@bgrant0607 |
A PR would be welcome. :-) |
@abonas I agree, though I'm not sure we have time to make the change soon. Since all the "states" contain a subset of the fields of ContainerStateTerminated, I think it would be simpler to essentially use those fields (some renamed), plus a status field.
|
Brian, For longer term, are you deeply against using custom JSON unmarshalling to For example, suppose we used something like 'go generate' to expand a
and elsewhere
This seems imminently doable and produces a nearly-ideal JSON api for On Wed, May 6, 2015 at 11:55 PM, Brian Grant notifications@github.com
|
@bgrant0607 |
The change would go into at most v1. We'll be making decisions about what's in and out of v1 over the next few days. v1beta3, etc. wouldn't change. Note that we plan to get rid of v1beta1 and v1beta2 very soon. |
So does that mean that a PR containing this change for v1 must also include conversion handling for v1beta3? |
Yes, and v1beta1 and v1beta2 until we actually disable/remove them. |
@abonas Were you planning to work on this? (Since you asked about conversions.) |
@caesarxuchao will rename state.termination to state.terminated (ditto for lastState). |
I wanted to, but now it seems I can't make it given the timeframes. |
@abonas There are no sig labels on this issue. Please add a sig label by: |
/sig node |
Issues go stale after 90d 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 |
This isn't going to change any time soon. Ref #8190 |
Each container's state section (in containerStatuses in Pod entity) has the real status/state as a key instead of a value.
Example (some irrelevant attributes omitted to make it shorter)
"containerStatuses": [
{
"name": "php-redis",
"state": {
"running": {
"startedAt": "2015-04-17T14:12:29Z"
}
},
"lastState": {},
}
]
It's very inconvenient on client side to parse the state section and guess/rely on the fact that the key itself holds the status and changes dynamically from case to case.
Why not have a statically named key such as code/status/anything else, and have the status as its value?
The text was updated successfully, but these errors were encountered: