-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds the capability of adding new nodes after a deployment is started
- Loading branch information
1 parent
e1c9922
commit f8299e6
Showing
10 changed files
with
329 additions
and
174 deletions.
There are no files selected for viewing
This file contains 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 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,52 @@ | ||
============================ | ||
Adding New Nodes Dynamically | ||
============================ | ||
|
||
It is possible to add new nodes dynamically after a defined deployment is started. New nodes can only be created out of | ||
pre-defined services and they can't include any internal events. In the following code, ``service1`` service is first created | ||
similar to the one in :doc:`quickstart`. Then, at line 31, a new node named ``n2`` is being created out of ``service1`` service. | ||
``Node.limitedBuilder`` method returns an instance of ``Node.LimitedBuilder`` which then can be further customized by chaining the proper | ||
method calls. This builder wouldn't allow the definition of internal events for the node. However, all the other node configurations | ||
are available. | ||
|
||
.. code-block:: java | ||
:linenos: | ||
public class SampleTestIT { | ||
protected static FailifyRunner runner; | ||
@BeforeClass | ||
public static void before() throws RuntimeEngineException { | ||
String projectVersion = "0.2.1"; | ||
Deployment deployment = Deployment.builder("sampleTest") | ||
// Service Definition | ||
.withService("service1") | ||
.applicationPath("target/project.zip", "/project", PathAttr.COMPRESSED) | ||
.startCommand("/project/bin/start.sh") | ||
.dockerImage("project/sampleTest:" + projectVersion) | ||
.dockerFileAddress("docker/Dockerfile", false) | ||
.serviceType(ServiceType.JAVA).and() | ||
// Node Definitions | ||
.withNode("n1", "service1").and() | ||
.build(); | ||
FailifyRunner runner = FailifyRunner.run(deployment); | ||
} | ||
@AfterClass | ||
public static void after() { | ||
if (runner != null) { | ||
runner.stop(); | ||
} | ||
} | ||
public void test1() throws RuntimeEngineException { | ||
.. | ||
runner.addNode(Node.limitedBuilder("n2", "s1")); | ||
.. | ||
} | ||
} | ||
The current limitation of this capability is that if there is a network partition applied to the current deployment, the | ||
new node wouldn't be included in that network partition. Introduction of new network partitions will include the new node | ||
in generating blocking rules for iptables. This limitation will be removed in future releases. |
This file contains 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 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
Oops, something went wrong.