Closed misterdjules closed 9 years ago
LGTM.
Also, not necessarily a question for this PR but maybe to avoid problems further down the road, I'm not a big fan of checking the client's API version in code that is not strictly at the API/HTTP params handling layer. It seems that it's how different client API versions are currently handled, so I did it that way.
Would it make sense to create models (for containers and other objects that are used in the API's input/output) that are "version agnostic" to use at the "model" layer, and then parse/send them using the correct format depending on the client API version at the API/HTTP layer?
Yes, I think that would be nice. Agreed that having clientApiVersion
used in the backend layer sucks.
Would you like to start a separate ticket for that?
@trentm Thanks, landed in 4086be723ba6e89a22e9d60fa8d239eab4edb1bc and created a ticket about handling clientApiVersion
at the HTTP/API layer only :+1:
The follow-up ticket mentioned above is at https://smartos.org/bugview/DOCKER-482.
This change addresses @trentm's code review comments about handling different API versions more explicitly regarding the
Memory
value passed by the docker client when creating a container.We could be "more liberal in what we accept" by also accepting
container.Memory
even when the client's API version is >= 1.18, and by acceptingcontainer.HostConfig.Memory
even when the client's API version is < 1.18, but we would use them as fallbacks.Also, not necessarily a question for this PR but maybe to avoid problems further down the road, I'm not a big fan of checking the client's API version in code that is not strictly at the API/HTTP params handling layer. It seems that it's how different client API versions are currently handled, so I did it that way.
Would it make sense to create models (for containers and other objects that are used in the API's input/output) that are "version agnostic" to use at the "model" layer, and then parse/send them using the correct format depending on the client API version at the API/HTTP layer?
@trentm @joshwilsdon @twhiteman Thoughts?