Skip to content

Commit

Permalink
Add affinity traits during redeployment
Browse files Browse the repository at this point in the history
Change-Id: Ie6f5ea814c2dea466dc91ee8a809e6976a274a9d
  • Loading branch information
rudi committed May 14, 2024
1 parent a5a444c commit 3961547
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,15 +511,18 @@ public static void redeployApplication(NebulousApp app, ObjectNode updatedKubeve
// 6. Call deployApplication
// 7. call scaleIn endpoint with list of removed node names

String kubevelaString = "---\n# Did not manage to create rewritten KubeVela";
// ------------------------------------------------------------
// Rewrite KubeVela
JsonNode rewritten = createDeploymentKubevela(updatedKubevela);
String rewritten_kubevela = "---\n# Did not manage to create rewritten KubeVela";
try {
kubevelaString = yamlMapper.writeValueAsString(updatedKubevela);
rewritten_kubevela = yamlMapper.writeValueAsString(rewritten);
} catch (JsonProcessingException e) {
log.error("Failed to convert KubeVela to YAML; this should never happen", e);
app.setStateFailed();
return;
}
Main.logFile("redeploy-rewritten-kubevela-" + appUUID + ".yaml", kubevelaString);
Main.logFile("rewritten-kubevela-" + appUUID + ".yaml", rewritten_kubevela);

// ------------------------------------------------------------
// 1. Extract node requirements
Expand Down Expand Up @@ -651,8 +654,8 @@ public static void redeployApplication(NebulousApp app, ObjectNode updatedKubeve
Main.logFile("redeploy-labelNodes-" + appUUID + ".json", nodeLabels.toPrettyString());
conn.labelNodes(appUUID, clusterName, nodeLabels);

log.info("Redeploying application: {}", kubevelaString);
conn.deployApplication(appUUID, clusterName, app.getName(), kubevelaString);
log.info("Redeploying application: {}", rewritten_kubevela);
conn.deployApplication(appUUID, clusterName, app.getName(), rewritten_kubevela);

if (!nodesToRemove.isEmpty()) {
Main.logFile("redeploy-scalein-" + appUUID + ".json", nodesToRemove);
Expand Down

0 comments on commit 3961547

Please sign in to comment.