From 4557a448239d7fc6c6d507edb5dce7a86c2e0135 Mon Sep 17 00:00:00 2001 From: Rudi Schlatte Date: Tue, 14 May 2024 16:59:56 +0200 Subject: [PATCH] Use correct environment variable message format Change-Id: I6885f1b3f376d146f3005e278bc40e27294a0965 --- .../optimiser/controller/NebulousAppDeployer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java index 03b9f28..01b0420 100644 --- a/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java +++ b/optimiser-controller/src/main/java/eu/nebulouscloud/optimiser/controller/NebulousAppDeployer.java @@ -406,9 +406,16 @@ public static void deployApplication(NebulousApp app, JsonNode kubevela) { }); ObjectNode environment = cluster.withObject("/env-var"); environment.put("APPLICATION_ID", appUUID); - // TODO: pre-parse environment variables, put them into NebulousApp + // TODO: consider pre-parsing environment variables and storing them + // in the app object instead of reading them from the raw dsl message + // here for (final JsonNode v : app.getOriginalAppMessage().withArray("/environmentVariables")) { - v.fields().forEachRemaining (field -> environment.put(field.getKey(), field.getValue().asText())); + if (v.has("name") && v.has("value") && v.get("name").isTextual()) { + // TODO: figure out what to do with the `"secret":true` field + environment.put(v.get("name").asText(), v.get("value").asText()); + } else { + log.warn("Invalid environmentVariables entry: {}", v); + } } log.info("Calling defineCluster"); boolean defineClusterSuccess = conn.defineCluster(appUUID, clusterName, cluster);