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

merge theodolite-kotlin

parents 670cf574 a0f1d04b
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!106Introduce a Theodolite operator,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Showing
with 53 additions and 3 deletions
...@@ -16,12 +16,22 @@ object TheodoliteYamlExecutor { ...@@ -16,12 +16,22 @@ object TheodoliteYamlExecutor {
fun main(args: Array<String>) { fun main(args: Array<String>) {
logger.info { "Theodolite started" } logger.info { "Theodolite started" }
val executionPath = System.getenv("THEODOLITE_EXECUTION") ?: "./config/BenchmarkExecution.yaml"
val benchmarkPath = System.getenv("THEODOLITE_BENCHMARK") ?: "./config/BenchmarkType.yaml"
val appResource = System.getenv("THEODOLITE_APP_RESOURCES") ?: "./config"
logger.info { "Using $executionPath for BenchmarkExecution" }
logger.info { "Using $benchmarkPath for BenchmarkType" }
logger.info { "Using $appResource for Resources" }
// load the BenchmarkExecution and the BenchmarkType // load the BenchmarkExecution and the BenchmarkType
val parser = YamlParser() val parser = YamlParser()
val benchmarkExecution = val benchmarkExecution =
parser.parse("./../../../resources/main/yaml/BenchmarkExecution.yaml", BenchmarkExecution::class.java)!! parser.parse(path = executionPath, E = BenchmarkExecution::class.java)!!
val benchmark = val benchmark =
parser.parse("./../../../resources/main/yaml/BenchmarkType.yaml", KubernetesBenchmark::class.java)!! parser.parse(path = benchmarkPath, E = KubernetesBenchmark::class.java)!!
benchmark.path = appResource
val shutdown = Shutdown(benchmarkExecution, benchmark) val shutdown = Shutdown(benchmarkExecution, benchmark)
Runtime.getRuntime().addShutdownHook(thread { shutdown.run()}) Runtime.getRuntime().addShutdownHook(thread { shutdown.run()})
......
package theodolite.patcher package theodolite.patcher
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
interface Patcher { interface Patcher {
fun <T> patch(value: T) fun <T> patch(value: T)
} }
package theodolite.strategies.restriction package theodolite.strategies.restriction
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
import theodolite.util.Results import theodolite.util.Results
...@@ -8,6 +9,7 @@ import theodolite.util.Results ...@@ -8,6 +9,7 @@ import theodolite.util.Results
* A "Restriction Strategy" restricts a list of resources based on the current * A "Restriction Strategy" restricts a list of resources based on the current
* results of all previously performed benchmarks. * results of all previously performed benchmarks.
*/ */
@RegisterForReflection
abstract class RestrictionStrategy(val results: Results) { abstract class RestrictionStrategy(val results: Results) {
/** /**
* Next Restrict the given resource list for the given load based on the result object. * Next Restrict the given resource list for the given load based on the result object.
......
package theodolite.strategies.searchstrategy package theodolite.strategies.searchstrategy
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.execution.BenchmarkExecutor import theodolite.execution.BenchmarkExecutor
import theodolite.strategies.restriction.RestrictionStrategy import theodolite.strategies.restriction.RestrictionStrategy
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
@RegisterForReflection
class CompositeStrategy( class CompositeStrategy(
benchmarkExecutor: BenchmarkExecutor, benchmarkExecutor: BenchmarkExecutor,
private val searchStrategy: SearchStrategy, private val searchStrategy: SearchStrategy,
......
package theodolite.strategies.searchstrategy package theodolite.strategies.searchstrategy
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.execution.BenchmarkExecutor import theodolite.execution.BenchmarkExecutor
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
@RegisterForReflection
abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor) { abstract class SearchStrategy(val benchmarkExecutor: BenchmarkExecutor) {
/** /**
* Find smallest suitable resource from the specified resource list for the given load. * Find smallest suitable resource from the specified resource list for the given load.
......
package theodolite.util package theodolite.util
import io.quarkus.runtime.annotations.RegisterForReflection
import theodolite.strategies.searchstrategy.CompositeStrategy import theodolite.strategies.searchstrategy.CompositeStrategy
@RegisterForReflection
data class Config( data class Config(
val loads: List<LoadDimension>, val loads: List<LoadDimension>,
val resources: List<Resource>, val resources: List<Resource>,
......
package theodolite.util package theodolite.util
import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.quarkus.runtime.annotations.RegisterForReflection
@JsonDeserialize @JsonDeserialize
@RegisterForReflection
class ConfigurationOverride { class ConfigurationOverride {
lateinit var patcher: PatcherDefinition lateinit var patcher: PatcherDefinition
lateinit var value: String lateinit var value: String
......
package theodolite.util package theodolite.util
import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.quarkus.runtime.annotations.RegisterForReflection
import org.apache.kafka.clients.admin.NewTopic import org.apache.kafka.clients.admin.NewTopic
import kotlin.properties.Delegates import kotlin.properties.Delegates
@RegisterForReflection
@JsonDeserialize @JsonDeserialize
class KafkaConfig { class KafkaConfig {
lateinit var bootstrapServer: String lateinit var bootstrapServer: String
...@@ -13,6 +15,7 @@ class KafkaConfig { ...@@ -13,6 +15,7 @@ class KafkaConfig {
return topics.map { topic -> NewTopic(topic.name, topic.numPartitions, topic.replicationFactor) } return topics.map { topic -> NewTopic(topic.name, topic.numPartitions, topic.replicationFactor) }
} }
@RegisterForReflection
class TopicWrapper { class TopicWrapper {
lateinit var name: String lateinit var name: String
var numPartitions by Delegates.notNull<Int>() var numPartitions by Delegates.notNull<Int>()
......
package theodolite.util package theodolite.util
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
data class LoadDimension(private val number: Int, private val type: List<PatcherDefinition>) { data class LoadDimension(private val number: Int, private val type: List<PatcherDefinition>) {
fun get(): Int { fun get(): Int {
return this.number return this.number
......
package theodolite.util package theodolite.util
import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.quarkus.runtime.annotations.RegisterForReflection
@JsonDeserialize @JsonDeserialize
@RegisterForReflection
class PatcherDefinition { class PatcherDefinition {
lateinit var type: String lateinit var type: String
lateinit var resource: String lateinit var resource: String
......
package theodolite.util package theodolite.util
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
data class PrometheusResponse( data class PrometheusResponse(
var status: String? = null, var status: String? = null,
var data: PromData? = null var data: PromData? = null
) )
@RegisterForReflection
data class PromData( data class PromData(
var resultType: String? = null, var resultType: String? = null,
var result: List<PromResult>? = null var result: List<PromResult>? = null
) )
@RegisterForReflection
data class PromResult( data class PromResult(
var metric: PromMetric? = null, var metric: PromMetric? = null,
var values: List<Any>? = null var values: List<Any>? = null
) )
@RegisterForReflection
data class PromMetric( data class PromMetric(
var group: String? = null var group: String? = null
) )
package theodolite.util package theodolite.util
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
data class Resource(private val number: Int, private val type: List<PatcherDefinition>) { data class Resource(private val number: Int, private val type: List<PatcherDefinition>) {
fun get(): Int { fun get(): Int {
return this.number return this.number
} }
......
package theodolite.util package theodolite.util
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
class Results { class Results {
private val results: MutableMap<Pair<LoadDimension, Resource>, Boolean> = mutableMapOf() private val results: MutableMap<Pair<LoadDimension, Resource>, Boolean> = mutableMapOf()
......
package theodolite.util package theodolite.util
import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection
@JsonDeserialize @JsonDeserialize
class TypeName { class TypeName {
lateinit var typeName: String lateinit var typeName: String
......
quarkus.package.main-class=TheodoliteOperator quarkus.package.main-class=TheodoliteYamlExecutor
\ No newline at end of file quarkus.native.additional-build-args=\
--initialize-at-run-time=io.fabric8.kubernetes.client.internal.CertUtils,\
--report-unsupported-elements-at-runtime
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment