diff --git a/deployment/helm/skaha/skaha-config/k8s-resources.json b/deployment/helm/skaha/skaha-config/k8s-resources.json index 82b27e4b..09cedec3 100644 --- a/deployment/helm/skaha/skaha-config/k8s-resources.json +++ b/deployment/helm/skaha/skaha-config/k8s-resources.json @@ -1,88 +1,94 @@ { - "cores-default-request": 1, - "cores-default-limit": 16, - "cores-default": 1, - "cores-default-headless": 1, - "cores-options": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16 - ], - "mem-gb-default-request": 4, - "mem-gb-default-limit": 192, - "mem-gb-default": 2, - "mem-gb-default-headless": 4, - "mem-gb-options": [ - 1, - 2, - 4, - 6, - 8, - 10, - 12, - 14, - 16, - 20, - 24, - 26, - 28, - 30, - 32, - 36, - 40, - 44, - 48, - 56, - 64, - 80, - 92, - 112, - 128, - 140, - 170, - 192 - ], - "gpus-options": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28 - ] + "cores": { + "default": 1, + "default-request": 1, + "default-limit": 16, + "default-headless": 1, + "options": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ] + }, + "memory": { + "default-request-gb": 4, + "default-limit-gb": 192, + "default-gb": 2, + "default-headless-gb": 4, + "options-gb": [ + 1, + 2, + 4, + 6, + 8, + 10, + 12, + 14, + 16, + 20, + 24, + 26, + 28, + 30, + 32, + 36, + 40, + 44, + 48, + 56, + 64, + 80, + 92, + 112, + 128, + 140, + 170, + 192 + ] + }, + "gpus": { + "options": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28 + ] + } } diff --git a/skaha/src/main/java/org/opencadc/skaha/context/ResourceContexts.java b/skaha/src/main/java/org/opencadc/skaha/context/ResourceContexts.java index 2cf43639..26fd356a 100644 --- a/skaha/src/main/java/org/opencadc/skaha/context/ResourceContexts.java +++ b/skaha/src/main/java/org/opencadc/skaha/context/ResourceContexts.java @@ -107,22 +107,24 @@ public ResourceContexts() { JsonObject jsonObject = jsonElement.getAsJsonObject(); // Extract fields into variables - defaultRequestCores= jsonObject.get("cores-default-request").getAsInt(); - defaultLimitCores = jsonObject.get("cores-default-limit").getAsInt(); - defaultCores = jsonObject.get("cores-default").getAsInt(); - defaultCoresHeadless = jsonObject.get("cores-default-headless").getAsInt(); - defaultRequestRAM = jsonObject.get("mem-gb-default-request").getAsInt(); - defaultLimitRAM = jsonObject.get("mem-gb-default-limit").getAsInt(); - defaultRAM = jsonObject.get("mem-gb-default").getAsInt(); - defaultRAMHeadless = jsonObject.get("mem-gb-default-headless").getAsInt(); - - JsonArray coresOptions = jsonObject.getAsJsonArray("cores-options"); + JsonObject cores = jsonObject.getAsJsonObject("cores"); + defaultRequestCores= cores.get("default-request").getAsInt(); + defaultLimitCores = cores.get("default-limit").getAsInt(); + defaultCores = cores.get("default").getAsInt(); + defaultCoresHeadless = cores.get("default-headless").getAsInt(); + JsonArray coresOptions = cores.getAsJsonArray("options"); coresOptions.asList().forEach(coreOption->availableCores.add(coreOption.getAsInt())); - JsonArray ramOptions = jsonObject.getAsJsonArray("mem-gb-options"); + JsonObject memory = jsonObject.getAsJsonObject("memory"); + defaultRequestRAM = memory.get("default-request-gb").getAsInt(); + defaultLimitRAM = memory.get("default-limit-gb").getAsInt(); + defaultRAM = memory.get("default-gb").getAsInt(); + defaultRAMHeadless = memory.get("default-headless-gb").getAsInt(); + JsonArray ramOptions = memory.getAsJsonArray("options-gb"); ramOptions.asList().forEach(ramOption -> availableRAM.add(ramOption.getAsInt())); - JsonArray gpuOptions = jsonObject.getAsJsonArray("gpus-option"); + JsonObject gpus = jsonObject.getAsJsonObject("gpus"); + JsonArray gpuOptions = gpus.getAsJsonArray("options"); gpuOptions.asList().forEach(gpuOption -> availableGPUs.add(gpuOption.getAsInt())); } catch (Exception e) { log.error(e);