diff --git a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/ExnConnector.java b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/ExnConnector.java index 05af839..34c03ab 100644 --- a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/ExnConnector.java +++ b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/ExnConnector.java @@ -392,45 +392,52 @@ public class ExnConnector { /** * Define a cluster with the given name and node list. - * - *
The nodes are passed in a JSON array containing objects of the - * following shape: - * + * + *
The cluster is passed in a JSON of the following shape: + * *
{@code * { - * "nodeName": "some-component", - * "nodeCandidateId": "some-candidate-id", - * "cloudId": "some-cloud-id" + * "name":"485d7-1", + * "master-node":"N485d7-1-masternode", + * "nodes":[ + * { + * "nodeName":"N485d7-1-masternode", + * "nodeCandidateId":"8a7481018e8572f9018e857ed0c50c53", + * "cloudId":"demo-cloud" + * }, + * { + * "nodeName":"N485d7-1-dummy-app-worker-1-1", + * "nodeCandidateId":"8a7481018e8572f9018e857ecfb30c21", + * "cloudId":"demo-cloud" + * } + * ], + * "env-var": { + * "APPLICATION_ID", "the-application-id" + * } * } * }- * - *
Each value for {@code nodeName} has to be globally unique, and - * should be either the name of the master node or the name of a node that - * will subsequently be referenced in the affinity trait of the modified - * kubevela file (see {@link NebulousAppDeployer#addNodeAffinities()}). - * + * + *
Each value for {@code nodeName} has to be globally unique, must + * start with a letter and contain numbers, letters and hyphens only. + * *
The values for {@code nodeCandidateId} and {@code cloudId} come from
* the return value of a call to {@link #findNodeCandidates()}.
- *
+ *
* @param appID The application's id, used only for logging.
- * @param clusterName The cluster name.
- * @param masterNodeName The name of the master node.
- * @param nodes A JSON array containing the node definitions, including the master node.
+ * @param clusterName The cluster name, used only for logging.
+ * @param cluster A JSON object, as detailed above.
* @return true if the cluster was successfully defined, false otherwise.
*/
- public boolean defineCluster(String appID, String clusterName, String masterNodeName, ArrayNode nodes) {
+ public boolean defineCluster(String appID, String clusterName, ObjectNode cluster) {
// https://openproject.nebulouscloud.eu/projects/nebulous-collaboration-hub/wiki/deployment-manager-sal-1#specification-of-endpoints-being-developed
- ObjectNode body = mapper.createObjectNode()
- .put("name", clusterName)
- .put("master-node", masterNodeName);
- body.putArray("nodes").addAll(nodes);
+ Main.logFile("define-cluster-" + appID + ".json", cluster);
Map