Skip to content
Snippets Groups Projects
Commit 5655e181 authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

Merge branch 'theodolite-kotlin' of git.se.informatik.uni-kiel.de:she/spesb...

Merge branch 'theodolite-kotlin' of git.se.informatik.uni-kiel.de:she/spesb into feature/214-add-yaml-docs
parents 859dde24 1fc34921
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!125Add dokumentation for benchmark and execution,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -31,7 +31,7 @@ dependencies {
}
group 'theodolite'
version '1.0.0-SNAPSHOT'
version '0.5.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_11
......
package theodolite.patcher
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.apps.Deployment
import kotlin.math.pow
private const val NUM_SENSORS = 4.0
private const val LOAD_GEN_MAX_RECORDS = 150000
class NumNestedGroupsLoadGeneratorReplicaPatcher(private val k8sResource: KubernetesResource) : AbstractPatcher(k8sResource) {
override fun <String> patch(value: String) {
if (k8sResource is Deployment) {
if (value is kotlin.String) {
val approxNumSensors = NUM_SENSORS.pow(Integer.parseInt(value).toDouble())
val loadGenInstances = (approxNumSensors + LOAD_GEN_MAX_RECORDS -1) / LOAD_GEN_MAX_RECORDS
this.k8sResource.spec.replicas = loadGenInstances.toInt()
}
}
}
}
package theodolite.patcher
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.apps.Deployment
private const val LOAD_GEN_MAX_RECORDS = 150000
class NumSensorsLoadGeneratorReplicaPatcher(private val k8sResource: KubernetesResource) : AbstractPatcher(k8sResource) {
override fun <String> patch(value: String) {
if (k8sResource is Deployment) {
if (value is kotlin.String) {
val loadGenInstances = (Integer.parseInt(value) + LOAD_GEN_MAX_RECORDS - 1) / LOAD_GEN_MAX_RECORDS
this.k8sResource.spec.replicas = loadGenInstances
}
}
}
}
......@@ -30,6 +30,8 @@ class PatcherFactory {
k8sResources.filter { it.first == patcherDefinition.resource }.map { resource -> resource.second }[0]
return when (patcherDefinition.type) {
"ReplicaPatcher" -> ReplicaPatcher(resource)
"NumNestedGroupsLoadGeneratorReplicaPatcher" -> NumNestedGroupsLoadGeneratorReplicaPatcher(resource)
"NumSensorsLoadGeneratorReplicaPatcher" -> NumSensorsLoadGeneratorReplicaPatcher(resource)
"EnvVarPatcher" -> EnvVarPatcher(resource, patcherDefinition.container, patcherDefinition.variableName)
"NodeSelectorPatcher" -> NodeSelectorPatcher(resource, patcherDefinition.variableName)
"ResourceLimitPatcher" -> ResourceLimitPatcher(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment