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
563a65ec
Commit
563a65ec
authored
4 years ago
by
Lorenz Boguhn
Browse files
Options
Downloads
Patches
Plain Diff
Add limit and Image exchange funtions
parent
160f286a
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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theodolite-quarkus/YAML/aggregation-deployment.yaml
+55
-0
55 additions, 0 deletions
theodolite-quarkus/YAML/aggregation-deployment.yaml
theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
+34
-14
34 additions, 14 deletions
...e-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
with
89 additions
and
14 deletions
theodolite-quarkus/YAML/aggregation-deployment.yaml
0 → 100644
+
55
−
0
View file @
563a65ec
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
titan-ccp-aggregation
spec
:
selector
:
matchLabels
:
app
:
titan-ccp-aggregation
replicas
:
1
template
:
metadata
:
labels
:
app
:
titan-ccp-aggregation
spec
:
terminationGracePeriodSeconds
:
0
containers
:
-
name
:
uc-application
image
:
uc-app:latest
ports
:
-
containerPort
:
5555
name
:
jmx
env
:
-
name
:
KAFKA_BOOTSTRAP_SERVERS
value
:
"
my-confluent-cp-kafka:9092"
-
name
:
SCHEMA_REGISTRY_URL
value
:
"
http://my-confluent-cp-schema-registry:8081"
-
name
:
JAVA_OPTS
value
:
"
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=5555"
-
name
:
COMMIT_INTERVAL_MS
# Set as default for the applications
value
:
"
100"
resources
:
limits
:
memory
:
4Gi
cpu
:
1000m
-
name
:
prometheus-jmx-exporter
image
:
"
solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
command
:
-
java
-
-XX:+UnlockExperimentalVMOptions
-
-XX:+UseCGroupMemoryLimitForHeap
-
-XX:MaxRAMFraction=1
-
-XshowSettings:vm
-
-jar
-
jmx_prometheus_httpserver.jar
-
"
5556"
-
/etc/jmx-aggregation/jmx-kafka-prometheus.yml
ports
:
-
containerPort
:
5556
volumeMounts
:
-
name
:
jmx-config
mountPath
:
/etc/jmx-aggregation
volumes
:
-
name
:
jmx-config
configMap
:
name
:
aggregation-jmx-configmap
This diff is collapsed.
Click to expand it.
theodolite-quarkus/src/main/kotlin/theodolite/DeploymentManager.kt
+
34
−
14
View file @
563a65ec
package
theodolite
import
com.fasterxml.jackson.annotation.JsonProperty
import
io.fabric8.kubernetes.api.model.Quantity
import
io.fabric8.kubernetes.api.model.Service
import
io.fabric8.kubernetes.api.model.apps.Deployment
import
io.fabric8.kubernetes.client.DefaultKubernetesClient
...
...
@@ -11,12 +12,15 @@ import java.nio.file.Paths
class
DeploymentManager
{
val
MEMORYLIMIT
=
"memory"
val
CPULIMIT
=
"memory"
val
absolute
=
Paths
.
get
(
""
).
toAbsolutePath
().
toString
()
val
path
=
"/home/lorenz/git/spesb/theodolite-quarkus/YAML/"
val
theodoliteDeploment
=
"theodolite.yaml"
val
service
=
"aggregation-service.yaml"
val
workloadFile
=
"workloadGenerator.yaml"
val
usecase
=
"aggregation-deployment.yaml"
val
inputStream
:
InputStream
=
path
.
byteInputStream
()
val
client
=
DefaultKubernetesClient
().
inNamespace
(
"default"
)
...
...
@@ -25,25 +29,32 @@ class DeploymentManager {
val
dp
:
Service
=
client
.
services
().
load
(
path
+
service
).
get
();
val
workload
:
Deployment
=
client
.
apps
().
deployments
().
load
(
path
+
workloadFile
).
get
();
val
use
:
Deployment
=
client
.
apps
().
deployments
().
load
(
path
+
usecase
).
get
();
// TODO MAKE YAML LOADING CATCH EXEPTION
fun
printFile
(){
//
// println(workload)
// changeWorkloadNumInstances(workload,"5000")
// println(workload)
//
println(
workload
)
change
WorkloadNumInstances
(
workload
,
5000
)
//
println(
workload
)
println
(
use
)
change
RessourceLimits
(
use
,
MEMORYLIMIT
,
"5Gi"
)
println
(
use
)
println
(
path
)
val
f
:
File
=
File
(
path
+
theodoliteDeploment
);
val
fileAsString
:
String
=
String
(
f
.
readBytes
())
//
println(fileAsString.replace("theodolite","spesb"))
//
println(path)
//
val f : File = File(path+theodoliteDeploment);
//
val fileAsString : String = String(f.readBytes())
//
println(fileAsString.replace("theodolite","spesb"))
}
// SERVICE
fun
changeServiceName
(
service
:
Service
,
newName
:
String
){
service
.
metadata
.
apply
{
...
...
@@ -51,19 +62,28 @@ class DeploymentManager {
}
}
fun
changeWorkloadNumInstances
(
dep
:
Deployment
,
num
:
String
){
// WORKLOAD GEN
fun
changeWorkloadNumInstances
(
dep
:
Deployment
,
num
:
String
)
{
val
vars
=
dep
.
spec
.
template
.
spec
.
containers
.
get
(
0
).
env
.
filter
{
dep
.
spec
.
template
.
spec
.
containers
.
get
(
0
).
env
.
filter
{
it
.
name
==
"NUM_SENSORS"
}.
forEach
{
x
->
x
.
value
=
num
}.
forEach
{
x
->
x
.
value
=
num
}
}
// APPLICATION
fun
changeRessourceLimits
(
dep
:
Deployment
,
ressource
:
String
,
limit
:
String
)
{
println
(
vars
)
val
vars
=
dep
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
"uc-application"
}.
forEach
{
it
.
resources
.
limits
.
replace
(
ressource
,
Quantity
(
limit
))
}
}
fun
changeImage
(
dep
:
Deployment
,
image
:
String
)
{
dep
.
spec
.
template
.
spec
.
containers
.
filter
{
it
.
name
==
"uc-application"
}.
forEach
{
it
.
image
=
image
}
}
}
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