-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Swarm Mode: Swarm endpoints #686
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
Conversation
|
In english please. Is it swarm mode or swarm? |
|
How swarm mode could be tested? |
|
There are unit tests (though failing atm, they passed locally... I'll have to check), using dind when multiple docker engines are required at the same time, as you suggested. |
|
The build still fails, but only for unrelated tests. @KostyaSha, it would be cool if you could review this MR. Btw., is it ok for this MR to have so many commits, or should I rebase? |
|
Github allows squash merge, so don't worry. |
|
@KostyaSha In KostyaSha/yet-another-docker-plugin#54 you wrote this PR is stuck because of integration tests, but in https://github.com/docker-java/docker-java/pull/673#issuecomment-240420512, you told me to ignore the failing tests - so I'm not quite sure how to proceed. It would be cool to get this one merged soon so that we can base the remaining three branches (Services, Nodes and Tasks) on master and use the required Swarm functionality there for the tests. I realize you do this in your free time and I don't want to push you or anything, but in case I can do something to get this merged quicker, let me know. |
|
|
||
| import com.github.dockerjava.api.async.ResultCallback; | ||
| import com.github.dockerjava.api.command.AttachContainerCmd; | ||
| import com.github.dockerjava.api.command.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use hash imports.
|
Could you move all |
|
Branch start is not compilable. |
f51447f to
8ebb085
Compare
|
Could you rebase? |
|
@marcuslinke i will merge if didn't find any more issues. |
- Swarm integration env - disable failing tests
|
I made |
| * @since 1.24 | ||
| */ | ||
| @JsonProperty("Protocol") | ||
| private ExternalCAProtocol protocol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not string? I see alone enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definition in the engine-api follows the pattern of enums.
| @@ -0,0 +1,63 @@ | |||
| package com.github.dockerjava.api.model; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe create and move to swarm package? I guess model folder will be huge soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even swarmmode as swarm will be for swarm?
| private Long nodeCertExpiry; | ||
|
|
||
| @JsonProperty("ExternalCAs") | ||
| private ExternalCA[] externalCA; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use List
| * @since 1.24 | ||
| */ | ||
| @JsonProperty("LogDriver") | ||
| private Driver logDriver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name class LogDriver ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's called Driver in the engine-api too, and it's pretty generic, so might be the case that it is used for other drivers in the future.
| private String advertiseAddr; | ||
|
|
||
| @JsonProperty("RemoteAddrs") | ||
| private String[] remoteAddrs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List
|
|
||
| final RemoteApiVersion apiVersion = getVersion(dockerClient); | ||
| if (!apiVersion.isGreaterOrEqual(RemoteApiVersion.VERSION_1_24)) { | ||
| throw new SkipException("API version should be >= 1.24"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For swarm branch it should also check isNotSwarm()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do I find this isNotSwarm?
| protected DockerClient secondDockerClient; | ||
| private int numberOfDockersInDocker = 0; | ||
|
|
||
| private static final int PORT_START = 2378; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i right understand, then test should pick random port instead of hardcode. It only affects exposed port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The port is the one that is used to communicate with the docker API. Picking it randomly increases chances of collision and makes it harder to debug. What are the advantages of randomly picking?
|
Great work, still reviewing... |
|
I am waiting to use this swarm mode api as soon as it is merged! |
|
I created ITs, started merging into branch... AFAIR i asked some questions and didn't get response... Will continue on weekend. |
|
Sorry for the delay. We had to finish our project and due to lack of resources, we did not update these PRs but rather worked on one branch for everything swarm related. These is the whole Swarm API code as we are using it. We'd like to get it merged, too, so that we can use the next official version. It is a lot of work to separate it into the different APIs again as I tried to do with the PRs here. So the easiest for us would be to squash that big thing together and apply the comments of the PRs here. We can also try to split the code again. Then, we would start with PR #673, and once this is merged, update the other PRs because they need some of the code of #673. I'll try to update that PR now. |
|
Sorry, I was wrong, this is the one to merge first, Service API comes after that. I rebased, applied some of your suggestions and replied to the others. |
|
Hi, i think we need merge everything into swarm branch, then play with it and merge. |
|
Oh, i can change base in GH UI now. WIll try, one sec. |
|
Err i'm not sure if I did this correctly, I rebased this branch on |
|
Seems it pick commits that had conflicts. I usually doing |
|
Ok, thanks. |
|
I think the build fails because of concurrent test runs. Do you think we can run the swarm tests sequentially? Otherwise, we need to assign random/sequential ports for the swarm listen address. |
|
I had no chance to look at tests, but it seems that running dind with random ports to initialize/etc will be the right solution. Also Host/port are injected in environments if you are creating docker-java client with default vars they may pick wrong values. |
|
When will this pull request be merged? I am looking forward to using the swarm mode. |
|
Hey, so, in general it just lacks the tests passing, right? The issue is that concurrently they fail but serially they're all fine. Is this correct? |
3052ba0 to
0c21e76
Compare
|
picked in #717 |
APIs for docker 1.12's
swarmendpointThis change is