Commit aa530ac5 authored by Koehorst, Jasper's avatar Koehorst, Jasper
Browse files

envmap added

parent c4f49f63
Pipeline #23260 passed with stage
in 1 minute and 19 seconds
......@@ -114,7 +114,7 @@ public class Kubernetes {
private static void getYamls(CommandOptionsKubernetes commandOptionsKubernetes, Connection connection) throws JargonException, GenQueryBuilderException, JargonQueryException, IOException, ApiException, InterruptedException {
// List all project turtle files...
if (commandOptionsKubernetes.project.contains("references")) {
String path = "/" + commandOptionsKubernetes.zone + "/references/genomes/bacteria%";
String path = "/" + commandOptionsKubernetes.zone + "/references/genomes/bacteria%mycoplasma%";
if (commandOptionsKubernetes.reset)
resetFailures(connection, path);
Search.getAllUnprocessedReferences(commandOptionsKubernetes, connection, path);
......@@ -262,6 +262,16 @@ public class Kubernetes {
containerItem.name(UUID.randomUUID().toString());
containerItem.image("docker-registry.wur.nl/unlock/docker");
// Set path environment through rancher environment variable using the envFrom object
// Project (unlock) > Resources > Config > Key / Value environment
List<V1EnvFromSource> envFrom = new ArrayList<>();
V1EnvFromSource v1EnvFromSource = new V1EnvFromSource();
V1ConfigMapEnvSource v1ConfigMapEnvSource = new V1ConfigMapEnvSource();
v1ConfigMapEnvSource.setName("path");
v1EnvFromSource.setConfigMapRef(v1ConfigMapEnvSource);
envFrom.add(v1EnvFromSource);
containerItem.setEnvFrom(envFrom);
V1ResourceRequirements resource = new V1ResourceRequirements();
// Set limits to the job
Map<String, Quantity> limit = new HashMap<>();
......@@ -313,19 +323,19 @@ public class Kubernetes {
// Unlock mount
containerItem.addVolumeMountsItem(new V1VolumeMount().name("unlock").mountPath("/unlock"));
// HashMap TODO make this a secret
HashMap<String, String> envMap = new HashMap<>();
envMap.put("PATH", "/root/.sdkman/candidates/maven/current/bin:/root/.sdkman/candidates/java/current/bin:/root/.sdkman/candidates/gradle/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
// // HashMap TODO make this a secret
// HashMap<String, String> envMap = new HashMap<>();
// envMap.put("PATH", "/root/.sdkman/candidates/maven/current/bin:/root/.sdkman/candidates/java/current/bin:/root/.sdkman/candidates/gradle/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
List<V1EnvVar> env = new ArrayList();
for (String key : envMap.keySet()) {
V1EnvVar v1EnvVar = new V1EnvVar();
v1EnvVar.setName(key);
v1EnvVar.setValue(envMap.get(key));
env.add(v1EnvVar);
}
// List<V1EnvVar> env = new ArrayList();
// for (String key : envMap.keySet()) {
// V1EnvVar v1EnvVar = new V1EnvVar();
// v1EnvVar.setName(key);
// v1EnvVar.setValue(envMap.get(key));
// env.add(v1EnvVar);
// }
containerItem.env(env);
// containerItem.env(env);
// Set the name
String name = "cwl-" + new File(yamlFile).getParentFile().getName().toLowerCase().replaceAll("[_\\.]", "") + "-" + new File(yamlFile).getName().toLowerCase().replaceAll("[_\\.]", "");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment