-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Proposal: Roadmap to replace samalba/dockerclient with engine-api/client #1879
Comments
cc @docker/core-swarm-maintainers |
same as #1560? |
@MHBauer thanks, I'd missed that issue. We can start a fresh discussion here, and close that issue, or continue there if others prefer that. Looking over the comments there, I can see that |
I think this effort is a great testbed for how we address the needs of people outside the docker cli itself. There isn't a nopClient, but I think it should be able to be rigged up internally for now, giving it a mock type client. Definitely something we can get into engine-api if it's a pain to configure. |
Here are some good comments regarding the nopclient, from an issue I opened in For now, I'm going to create our own nopclient, but we could consider moving away from it in the future. |
What I see left. I think it would be 'okay' to leave the tests, if only to have some diversity.
|
@MHBauer thanks. Based on the checklist above, all of the items you listed should fall under the following two categories
There may still be minor things left, but the major part of the work should be done. |
Problem
Swarm has been using
samalba/dockerclient
to send requests to Engines in the cluster so far. This has been a limiting factor for supporting new features of the Engine API, sincedockerclient
is outdated and does not fully support the current Engine API.Solution
engine-api/client
contains the officially supported Docker API, along with the relevant type structs and client. We need to be using that instead.Challenge
All Swarm changes currently go through
dockerclient
, all of which need to be moved over to useengine-api
, along with new using new type structs defined inengine-api/types
and updating unit and integration tests. This is a large change that will take time to fully accomplish and test for correctness.Proposal
The simplest way to start is to add a new
engine-api/client
object in theEngine
struct in Swarm, which uses the same underlying HTTP connection that is used bydockerclient
. This means that the two clients will co-exist in Swarm while using the same underlying connection.Once this is done, we should start moving over individual API endpoints to use the new client. We must make sure that this does not affect or cause any issues to existing Swarm users, except for the addition of new features that
engine-api
allows us to implement.Roadmap
The proposal will be implemented in the following steps:
engine-api
client in Swarm, and use it to replace theVersion()
function withServerVersion()
. This will involve adding/updating Godeps, creating mock and nop clients, and updating tests. This part is handled in Introducing engine-api client into Swarm #1880.Info()
function to use its equivalent inengine-api
. This is another small change, with several more changes likely needed, because of type mismatches between theInfo
structs in the two client libraries. For simplicity, we should perform type conversions (mostly betweenint
andint64
as needed) - this is a BAD idea in general, but only a temporary solution until some of the next few changes take effect. This part is handled in Updating info function to use engine-api #1938.ContainerConfig
struct in thecluster
package to useContainerConfig
fromengine-api/types
. This should mostly take care of the messy type conversions required in the previous step. We will also need to change all functions that create/modifyContainerConfig
. This change will span across a large part of the codebase, and move over complete container management toengine-api
. This part is handled in Updating ContainerConfig to use engine-api #1983, Moving start container to engine-api #2127, Move container rename and remove to engine-api #2128, use engine-api to replace dockerclient #2194.handlers.go
, focus on individual API endpoints to move them to the new client. The endpoints can be roughly grouped into the following categoriesHostConfig
on/start
(Stop allowing the passing ofHostConfig
on Container Start #2756)dockerclient
(as opposed to what we do right now). This might need some additional pipelining since Swarm needs some extra features, such as timeout. (Creating http client in swarm #2206, Use http client created in Swarm #2757)Important considerations
dockerclient
andengine-api
(Thanks to @dongluochen for bringing this up)engine-api
and 'dockerclient` have different types, and this affects the JSON returned by the Swarm API. (Thanks to @amitshukla for bringing this up)The text was updated successfully, but these errors were encountered: