Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UNLOCK
kubernetes
Commits
aa530ac5
Commit
aa530ac5
authored
May 26, 2021
by
Koehorst, Jasper
Browse files
envmap added
parent
c4f49f63
Pipeline
#23260
passed with stage
in 1 minute and 19 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/nl/munlock/kubernetes/Kubernetes.java
View file @
aa530ac5
...
@@ -114,7 +114,7 @@ public class Kubernetes {
...
@@ -114,7 +114,7 @@ public class Kubernetes {
private
static
void
getYamls
(
CommandOptionsKubernetes
commandOptionsKubernetes
,
Connection
connection
)
throws
JargonException
,
GenQueryBuilderException
,
JargonQueryException
,
IOException
,
ApiException
,
InterruptedException
{
private
static
void
getYamls
(
CommandOptionsKubernetes
commandOptionsKubernetes
,
Connection
connection
)
throws
JargonException
,
GenQueryBuilderException
,
JargonQueryException
,
IOException
,
ApiException
,
InterruptedException
{
// List all project turtle files...
// List all project turtle files...
if
(
commandOptionsKubernetes
.
project
.
contains
(
"references"
))
{
if
(
commandOptionsKubernetes
.
project
.
contains
(
"references"
))
{
String
path
=
"/"
+
commandOptionsKubernetes
.
zone
+
"/references/genomes/bacteria%"
;
String
path
=
"/"
+
commandOptionsKubernetes
.
zone
+
"/references/genomes/bacteria%
mycoplasma%
"
;
if
(
commandOptionsKubernetes
.
reset
)
if
(
commandOptionsKubernetes
.
reset
)
resetFailures
(
connection
,
path
);
resetFailures
(
connection
,
path
);
Search
.
getAllUnprocessedReferences
(
commandOptionsKubernetes
,
connection
,
path
);
Search
.
getAllUnprocessedReferences
(
commandOptionsKubernetes
,
connection
,
path
);
...
@@ -262,6 +262,16 @@ public class Kubernetes {
...
@@ -262,6 +262,16 @@ public class Kubernetes {
containerItem
.
name
(
UUID
.
randomUUID
().
toString
());
containerItem
.
name
(
UUID
.
randomUUID
().
toString
());
containerItem
.
image
(
"docker-registry.wur.nl/unlock/docker"
);
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
();
V1ResourceRequirements
resource
=
new
V1ResourceRequirements
();
// Set limits to the job
// Set limits to the job
Map
<
String
,
Quantity
>
limit
=
new
HashMap
<>();
Map
<
String
,
Quantity
>
limit
=
new
HashMap
<>();
...
@@ -313,19 +323,19 @@ public class Kubernetes {
...
@@ -313,19 +323,19 @@ public class Kubernetes {
// Unlock mount
// Unlock mount
containerItem
.
addVolumeMountsItem
(
new
V1VolumeMount
().
name
(
"unlock"
).
mountPath
(
"/unlock"
));
containerItem
.
addVolumeMountsItem
(
new
V1VolumeMount
().
name
(
"unlock"
).
mountPath
(
"/unlock"
));
// HashMap TODO make this a secret
//
// HashMap TODO make this a secret
HashMap
<
String
,
String
>
envMap
=
new
HashMap
<>();
//
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"
);
//
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
();
//
List<V1EnvVar> env = new ArrayList();
for
(
String
key
:
envMap
.
keySet
())
{
//
for (String key : envMap.keySet()) {
V1EnvVar
v1EnvVar
=
new
V1EnvVar
();
//
V1EnvVar v1EnvVar = new V1EnvVar();
v1EnvVar
.
setName
(
key
);
//
v1EnvVar.setName(key);
v1EnvVar
.
setValue
(
envMap
.
get
(
key
));
//
v1EnvVar.setValue(envMap.get(key));
env
.
add
(
v1EnvVar
);
//
env.add(v1EnvVar);
}
//
}
containerItem
.
env
(
env
);
//
containerItem.env(env);
// Set the name
// Set the name
String
name
=
"cwl-"
+
new
File
(
yamlFile
).
getParentFile
().
getName
().
toLowerCase
().
replaceAll
(
"[_\\.]"
,
""
)
+
"-"
+
new
File
(
yamlFile
).
getName
().
toLowerCase
().
replaceAll
(
"[_\\.]"
,
""
);
String
name
=
"cwl-"
+
new
File
(
yamlFile
).
getParentFile
().
getName
().
toLowerCase
().
replaceAll
(
"[_\\.]"
,
""
)
+
"-"
+
new
File
(
yamlFile
).
getName
().
toLowerCase
().
replaceAll
(
"[_\\.]"
,
""
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment