Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sören Henning
theodolite
Commits
35579558
Commit
35579558
authored
4 years ago
by
Lorenz Boguhn
Browse files
Options
Downloads
Patches
Plain Diff
Add deploy and delete methods
parent
4da0a590
No related branches found
No related tags found
4 merge requests
!159
Re-implementation of Theodolite with Kotlin/Quarkus
,
!157
Update Graal Image in CI pipeline
,
!83
WIP: Re-implementation of Theodolite with Kotlin/Quarkus
,
!78
Resolve "Implement Quarkus/Kotlin protype"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
+25
-17
25 additions, 17 deletions
...e-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
with
25 additions
and
17 deletions
theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
+
25
−
17
View file @
35579558
...
@@ -43,14 +43,13 @@ class DeploymentManager {
...
@@ -43,14 +43,13 @@ class DeploymentManager {
// changeRessourceLimits(use, MEMORYLIMIT, "5Gi")
// changeRessourceLimits(use, MEMORYLIMIT, "5Gi")
// logger.debug(use.toString())
// logger.debug(use.toString())
logger
.
info
(
workload
.
toString
()
)
deploy
(
workload
)
val
testMap
=
mapOf
<
String
,
String
>(
"NUM_SENSORS"
to
"5000"
)
logger
.
info
{
"Workload deployed"
}
val
vars
=
Thread
.
sleep
(
Duration
(
java
.
time
.
Duration
.
ofSeconds
(
30
)).
duration
.
toMillis
())
workload
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
"workload-generator"
}.
forEach
{
it
:
Container
->
logger
.
info
{
"will delete workload now!"
}
setContainerEnv
(
it
,
testMap
)
delete
(
workload
)
}
logger
.
info
{
"workld deletet"
}
logger
.
info
(
workload
.
toString
())
// logger.debug(config.toString())
// logger.debug(config.toString())
...
@@ -65,10 +64,10 @@ class DeploymentManager {
...
@@ -65,10 +64,10 @@ class DeploymentManager {
* @param container - The Container
* @param container - The Container
* @param map - Map of k=Name,v =Value of EnviromentVariables
* @param map - Map of k=Name,v =Value of EnviromentVariables
*/
*/
fun
setContainerEnv
(
container
:
Container
,
map
:
Map
<
String
,
String
>)
{
private
fun
setContainerEnv
(
container
:
Container
,
map
:
Map
<
String
,
String
>)
{
map
.
forEach
{
k
,
v
->
map
.
forEach
{
k
,
v
->
// filter for mathing name and set value
// filter for mathing name and set value
val
x
=
container
.
env
.
filter
{
env
v
ar
->
env
v
ar
.
name
==
k
}
val
x
=
container
.
env
.
filter
{
env
V
ar
->
env
V
ar
.
name
==
k
}
if
(
x
.
isEmpty
())
{
if
(
x
.
isEmpty
())
{
val
newVar
=
EnvVar
(
k
,
v
,
EnvVarSource
())
val
newVar
=
EnvVar
(
k
,
v
,
EnvVarSource
())
...
@@ -82,7 +81,7 @@ class DeploymentManager {
...
@@ -82,7 +81,7 @@ class DeploymentManager {
}
}
/**
/**
* Set the enviroment Variable for a
C
ontainer
* Set the enviroment Variable for a
c
ontainer
*/
*/
fun
setWorkloadEnv
(
workloadDeployment
:
Deployment
,
containerName
:
String
,
map
:
Map
<
String
,
String
>)
{
fun
setWorkloadEnv
(
workloadDeployment
:
Deployment
,
containerName
:
String
,
map
:
Map
<
String
,
String
>)
{
workloadDeployment
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
containerName
}
workloadDeployment
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
containerName
}
...
@@ -92,21 +91,30 @@ class DeploymentManager {
...
@@ -92,21 +91,30 @@ class DeploymentManager {
}
}
/**
/**
* Change the RessourceLimit of
the
SUT
* Change the RessourceLimit of
a container (Usally
SUT
)
*/
*/
fun
changeRessourceLimits
(
dep
:
Deployment
,
ressource
:
String
,
limit
:
String
)
{
fun
changeRessourceLimits
(
dep
loyment
:
Deployment
,
ressource
:
String
,
containerName
:
String
,
limit
:
String
)
{
val
vars
=
dep
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
"uc-application"
}.
forEach
{
val
vars
=
dep
loyment
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
containerName
}.
forEach
{
it
.
resources
.
limits
.
replace
(
ressource
,
Quantity
(
limit
))
it
.
resources
.
limits
.
replace
(
ressource
,
Quantity
(
limit
))
}
}
}
}
/**
/**
* Change the image
of the
SUT and the Worklaodgenerators
* Change the image
name of a container (
SUT and the Worklaodgenerators
)
*/
*/
fun
changeImage
(
dep
:
Deployment
,
image
:
String
)
{
fun
setImageName
(
deployment
:
Deployment
,
containerName
:
String
,
image
:
String
)
{
deployment
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
containerName
}.
forEach
{
dep
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
"uc-application"
}.
forEach
{
it
.
image
=
image
it
.
image
=
image
}
}
}
}
//TODO potential add exception handling
fun
deploy
(
deployment
:
Deployment
)
{
client
.
apps
().
deployments
().
create
(
deployment
)
}
//TODO potential add exception handling
fun
delete
(
deployment
:
Deployment
)
{
client
.
apps
().
deployments
().
delete
(
deployment
)
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment