-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/github/dockerjava/api/command/InitializeSwarmCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
|
|
||
| import com.github.dockerjava.api.model.SwarmSpec; | ||
|
|
||
| import javax.annotation.CheckForNull; | ||
|
|
||
| public interface InitializeSwarmCmd extends SyncDockerCmd<Void> { | ||
|
|
||
| @CheckForNull | ||
| String getListenAddr(); | ||
|
|
||
| InitializeSwarmCmd withListenAddr(String listenAddr); | ||
|
|
||
| @CheckForNull | ||
| String getAdvertiseAddr(); | ||
|
|
||
| InitializeSwarmCmd withAdvertiseAddr(String advertiseAddr); | ||
|
|
||
| @CheckForNull | ||
| Boolean isForceNewCluster(); | ||
|
|
||
| InitializeSwarmCmd withForceNewCluster(Boolean forceNewCluster); | ||
|
|
||
| @CheckForNull | ||
| SwarmSpec getSwarmSpec(); | ||
|
|
||
| InitializeSwarmCmd withSwarmSpec(SwarmSpec swarmSpec); | ||
|
|
||
| @Override | ||
| Void exec(); | ||
|
|
||
| interface Exec extends DockerCmdSyncExec<InitializeSwarmCmd, Void> { | ||
|
|
||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/github/dockerjava/api/command/InspectSwarmCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
|
|
||
| import com.github.dockerjava.api.model.Swarm; | ||
|
|
||
| /** | ||
| * Inspect a swarm. | ||
| */ | ||
| public interface InspectSwarmCmd extends SyncDockerCmd<Swarm> { | ||
|
|
||
| @Override | ||
| Swarm exec(); | ||
|
|
||
| interface Exec extends DockerCmdSyncExec<InspectSwarmCmd, Swarm> { | ||
| } | ||
|
|
||
|
|
||
| } |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/github/dockerjava/api/command/JoinSwarmCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
|
|
||
| import javax.annotation.CheckForNull; | ||
| import java.util.List; | ||
|
|
||
| public interface JoinSwarmCmd extends SyncDockerCmd<Void> { | ||
|
|
||
| @CheckForNull | ||
| String getListenAddr(); | ||
|
|
||
| JoinSwarmCmd withListenAddr(String listenAddr); | ||
|
|
||
| @CheckForNull | ||
| String getAdvertiseAddr(); | ||
|
|
||
| JoinSwarmCmd withAdvertiseAddr(String advertiseAddr); | ||
|
|
||
| @CheckForNull | ||
| List<String> getRemoteAddrs(); | ||
|
|
||
| JoinSwarmCmd withRemoteAddrs(List<String> remoteAddrs); | ||
|
|
||
| @CheckForNull | ||
| String getJoinToken(); | ||
|
|
||
| JoinSwarmCmd withJoinToken(String joinToken); | ||
|
|
||
| @Override | ||
| Void exec(); | ||
|
|
||
| interface Exec extends DockerCmdSyncExec<JoinSwarmCmd, Void> { | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/github/dockerjava/api/command/LeaveSwarmCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
|
|
||
| import javax.annotation.CheckForNull; | ||
|
|
||
| public interface LeaveSwarmCmd extends SyncDockerCmd<Void> { | ||
|
|
||
| @CheckForNull | ||
| Boolean hasForceEnabled(); | ||
|
|
||
| LeaveSwarmCmd withForceEnabled(Boolean force); | ||
|
|
||
| @Override | ||
| Void exec(); | ||
|
|
||
| interface Exec extends DockerCmdSyncExec<LeaveSwarmCmd, Void> { | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, missed that it can be enabled in runtime (because also thinking about standard swarm tests that people also asking), thought that it could be done only during startup.
But i fear that other standard tests that may be running in parallel may fail.
SwarmMode related tests should be grouped into new group/category imho. And maybe we should create separate travis runs?
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.
Oh, the tests are run in parallel? That's complicated even for the swarm tests themselves, because they need to initialize/join/leave swarm mode a few times. How about running each test in its own dind? I added a nice helper method to spin up (and automatically remove) dinds because I need two docker engines in the Join test, anyway.
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.
Dind will have performance issues + port exposure issues. I would at all suggest to migrate to Junit with
@Ruleand@Resourcesas i already have a lot of working solutions in yet-another-docker-plugin for it.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.
See https://github.com/KostyaSha/yet-another-docker-plugin/blob/1931326a58c43093f3aff5e5c993ada2eb46f8c9/yet-another-docker-its/src/test/java/com/github/kostyasha/it/tests/NginxRegistryTest.java#L62-L115
About order as i understand all tests are not ordered by it's nature.
If swarm mode doesn't affect standard docker-engine mode, then it's fine.
It also maybe possible to do something in scopes of Suite afair or testng has something specific...