From facbfbabce9d7b675965d9d59f82c81effa66bb5 Mon Sep 17 00:00:00 2001 From: lorenz <stu203404@mail.uni-kiel.de> Date: Tue, 16 Mar 2021 11:08:29 +0100 Subject: [PATCH] initial try --- .../execution/TheodoliteCRDExecutor.kt | 25 +++++++++ .../execution/TheodoliteYamlExecutor.kt | 1 + .../src/main/resources/application.properties | 2 +- .../resources/yaml/BenchmarkExecutionCRD.yaml | 46 +++++++++++++++++ .../yaml/BenchmarkExecutionCRDShema.yaml | 51 +++++++++++++++++++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt create mode 100644 theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRD.yaml create mode 100644 theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRDShema.yaml diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt new file mode 100644 index 000000000..55b9765c5 --- /dev/null +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt @@ -0,0 +1,25 @@ +package theodolite.execution + +import io.fabric8.kubernetes.client.DefaultKubernetesClient +import io.quarkus.runtime.annotations.QuarkusMain +import mu.KotlinLogging +import kotlin.system.exitProcess + +private var DEFAULT_NAMESPACE = "default" +private val logger = KotlinLogging.logger {} + +@QuarkusMain(name = "TheodoliteCRDExecutor") +object TheodoliteCRDExecutor { + @JvmStatic + fun main(args: Array<String>) { + + val namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE + logger.info { "Using $namespace as namespace." } + + val client = DefaultKubernetesClient().inNamespace(namespace) + + println("hello there") + + exitProcess(0) + } +} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt index d5f733387..c3a98ef63 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt @@ -7,6 +7,7 @@ import theodolite.benchmark.KubernetesBenchmark import theodolite.util.YamlParser import kotlin.system.exitProcess +private var DEFAULT_NAMESPACE = "default" private val logger = KotlinLogging.logger {} @QuarkusMain(name = "TheodoliteYamlExecutor") diff --git a/theodolite-quarkus/src/main/resources/application.properties b/theodolite-quarkus/src/main/resources/application.properties index 869bd94ce..397f64e02 100644 --- a/theodolite-quarkus/src/main/resources/application.properties +++ b/theodolite-quarkus/src/main/resources/application.properties @@ -1 +1 @@ -quarkus.package.main-class=TheodoliteYamlExecutor \ No newline at end of file +quarkus.package.main-class=TheodoliteCRDExecutor \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRD.yaml b/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRD.yaml new file mode 100644 index 000000000..a91d12362 --- /dev/null +++ b/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRD.yaml @@ -0,0 +1,46 @@ +name: "Theodolite Test Context" +benchmark: "benchmarkType" +load: + loadType: "NumSensors" + loadValues: + - 50000 +resources: + resourceType: "Instances" + resourceValues: + - 1 +slos: + - sloType: "lag trend" + threshold: 1000 + prometheusUrl: "http://localhost:32656" + externalSloUrl: "http://localhost:80/evaluate-slope" + offset: 0 + warmup: 0 +execution: + strategy: "LinearSearch" + duration: 60 + repetitions: 1 + restrictions: + - "LowerBound" +configOverrides: + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-load-generator-deployment.yaml" + variableName: "env" + value: "prod" + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-kstreams-deployment.yaml" + variableName: "env" + value: "prod" + - patcher: + type: "ResourceLimitPatcher" + resource: "uc1-kstreams-deployment.yaml" + container: "uc-application" + variableName: "cpu" + value: "1000m" + - patcher: + type: "ResourceLimitPatcher" + resource: "uc1-kstreams-deployment.yaml" + container: "uc-application" + variableName: "memory" + value: "2Gi" \ No newline at end of file diff --git a/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRDShema.yaml b/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRDShema.yaml new file mode 100644 index 000000000..6ad7993a1 --- /dev/null +++ b/theodolite-quarkus/src/main/resources/yaml/BenchmarkExecutionCRDShema.yaml @@ -0,0 +1,51 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: Theodolite-Test-Context +spec: + name: string + benchmark: string + load: + loadType: string + loadValues: + - 50000 + resources: + resourceType: "Instances" + resourceValues: + - 1 + slos: + - sloType: "lag trend" + threshold: 1000 + prometheusUrl: "http://localhost:32656" + externalSloUrl: "http://localhost:80/evaluate-slope" + offset: 0 + warmup: 0 + execution: + strategy: "LinearSearch" + duration: 60 + repetitions: 1 + restrictions: + - "LowerBound" + configOverrides: + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-load-generator-deployment.yaml" + variableName: "env" + value: "prod" + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-kstreams-deployment.yaml" + variableName: "env" + value: "prod" + - patcher: + type: "ResourceLimitPatcher" + resource: "uc1-kstreams-deployment.yaml" + container: "uc-application" + variableName: "cpu" + value: "1000m" + - patcher: + type: "ResourceLimitPatcher" + resource: "uc1-kstreams-deployment.yaml" + container: "uc-application" + variableName: "memory" + value: "2Gi" \ No newline at end of file -- GitLab