Skip to content

Conversation

@Yogu
Copy link
Contributor

@Yogu Yogu commented Aug 29, 2016

APIs for docker 1.12's swarm endpoint


This change is Reviewable

@KostyaSha
Copy link
Member

In english please. Is it swarm mode or swarm?

@Yogu
Copy link
Contributor Author

Yogu commented Aug 29, 2016

Sorry for the comments, I made them for my coworker, they're already resolved. It's Swarm Mode. This is the basis for #678 and #673.

@Yogu Yogu changed the title Docker swarm Swarm Mode: Swarm endpoints Aug 29, 2016
@KostyaSha
Copy link
Member

How swarm mode could be tested?

@Yogu
Copy link
Contributor Author

Yogu commented Aug 29, 2016

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.

@Yogu
Copy link
Contributor Author

Yogu commented Aug 29, 2016

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?

@KostyaSha
Copy link
Member

Github allows squash merge, so don't worry.

@Yogu
Copy link
Contributor Author

Yogu commented Sep 1, 2016

@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.*;
Copy link
Member

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.

@KostyaSha
Copy link
Member

Could you move all SwarmMode integration tests into separate group?

@KostyaSha
Copy link
Member

Branch start is not compilable.

@Yogu Yogu force-pushed the docker-swarm branch 2 times, most recently from f51447f to 8ebb085 Compare September 6, 2016 22:07
@KostyaSha
Copy link
Member

Could you rebase?

@KostyaSha
Copy link
Member

@marcuslinke i will merge if didn't find any more issues.

- Swarm integration env
- disable failing tests
@KostyaSha
Copy link
Member

I made swarm branch for future 3.1.0 . What firstly could be merged for swarm-mode support? (i bit confused with all issues and prs already existing)

* @since 1.24
*/
@JsonProperty("Protocol")
private ExternalCAProtocol protocol;
Copy link
Member

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.

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name class LogDriver ?

Copy link
Contributor Author

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;
Copy link
Member

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");
Copy link
Member

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()

Copy link
Contributor Author

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;
Copy link
Member

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.

Copy link
Contributor Author

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?

@KostyaSha
Copy link
Member

Great work, still reviewing...

@tecgie
Copy link

tecgie commented Nov 1, 2016

I am waiting to use this swarm mode api as soon as it is merged!

@KostyaSha
Copy link
Member

I created ITs, started merging into branch... AFAIR i asked some questions and didn't get response... Will continue on weekend.

@Yogu
Copy link
Contributor Author

Yogu commented Nov 13, 2016

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.

@Yogu
Copy link
Contributor Author

Yogu commented Nov 13, 2016

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.

@KostyaSha
Copy link
Member

Hi, i think we need merge everything into swarm branch, then play with it and merge.

@KostyaSha
Copy link
Member

Oh, i can change base in GH UI now. WIll try, one sec.

@KostyaSha KostyaSha changed the base branch from master to swarm November 13, 2016 16:03
@Yogu
Copy link
Contributor Author

Yogu commented Nov 15, 2016

Err i'm not sure if I did this correctly, I rebased this branch on swarm, but now it's showing some commits that are not from us.

@KostyaSha
Copy link
Member

Seems it pick commits that had conflicts. I usually doing rebase -i and commenting unneeded commits, then resolving conflicts on my commits.

@Yogu
Copy link
Contributor Author

Yogu commented Nov 15, 2016

Ok, thanks.

@Yogu
Copy link
Contributor Author

Yogu commented Nov 15, 2016

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.

@KostyaSha
Copy link
Member

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.

@codecov-io
Copy link

codecov-io commented Nov 20, 2016

Codecov Report

❗ No coverage uploaded for pull request base (swarm@0c21e76). Click here to learn what that means.
The diff coverage is 65.66%.

Impacted file tree graph

@@           Coverage Diff            @@
##             swarm     #686   +/-   ##
========================================
  Coverage         ?   70.83%           
========================================
  Files            ?      334           
  Lines            ?     6864           
  Branches         ?      586           
========================================
  Hits             ?     4862           
  Misses           ?     1722           
  Partials         ?      280
Impacted Files Coverage Δ
...n/java/com/github/dockerjava/api/model/Driver.java 0% <0%> (ø)
.../github/dockerjava/api/model/PullResponseItem.java 50% <0%> (ø)
...thub/dockerjava/netty/exec/UpdateSwarmCmdExec.java 100% <100%> (ø)
...ithub/dockerjava/jaxrs/InitializeSwarmCmdExec.java 100% <100%> (ø)
...b/dockerjava/jaxrs/JerseyDockerCmdExecFactory.java 66.27% <100%> (ø)
...om/github/dockerjava/api/model/LocalNodeState.java 100% <100%> (ø)
...hub/dockerjava/core/command/LeaveSwarmCmdImpl.java 100% <100%> (ø)
...ithub/dockerjava/api/model/ExternalCAProtocol.java 100% <100%> (ø)
.../com/github/dockerjava/jaxrs/JoinSwarmCmdExec.java 100% <100%> (ø)
...b/dockerjava/core/command/InspectSwarmCmdImpl.java 100% <100%> (ø)
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c21e76...b5ab795. Read the comment docs.

@tecgie
Copy link

tecgie commented Nov 26, 2016

When will this pull request be merged? I am looking forward to using the swarm mode.

@cirocosta
Copy link
Contributor

cirocosta commented Dec 5, 2016

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?

@KostyaSha KostyaSha mentioned this pull request Feb 13, 2017
3 tasks
@KostyaSha KostyaSha added this to the 3.1.0 milestone Feb 13, 2017
@KostyaSha KostyaSha force-pushed the swarm branch 2 times, most recently from 3052ba0 to 0c21e76 Compare May 5, 2017 02:07
@KostyaSha
Copy link
Member

picked in #717

@KostyaSha KostyaSha closed this May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants