From f8cbe68a809717dae1e4d2d9da807f374cdba7b0 Mon Sep 17 00:00:00 2001 From: lorenz <stu203404@mail.uni-kiel.de> Date: Thu, 4 Feb 2021 05:49:36 +0100 Subject: [PATCH] Fix worloadGen url and add config map --- .../execution/TheodoliteExecutor.kt | 3 +- .../kotlin/theodolite/k8s/UC1Benchmark.kt | 18 ++++++--- .../resources/yaml/workloadGenerator.yaml | 40 +++++++++---------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index 2e6a02eb7..92eb0e7be 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -25,8 +25,9 @@ class TheodoliteExecutor() { ucDeploymentPath = path + "/aggregation-deployment.yaml", ucServicePath = path + "/aggregation-service.yaml", wgDeploymentPath = path + "/workloadGenerator.yaml", + configMapPath = path + "jmx-configmap", ucImageURL = "ghcr.io/cau-se/theodolite-uc1-kstreams-app:latest", - wgImageURL = "ghcr.io/cau-se/theodolite-uc1-kstreams-workload-generator:latest" + wgImageURL = "ghcr.io/cau-se/theodolite-uc1-workload-generator:theodolite-kotlin-latest" ) ) val results: Results = Results() diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt index bf535d3b8..d22e72310 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/UC1Benchmark.kt @@ -1,5 +1,6 @@ package theodolite.k8s +import io.fabric8.kubernetes.api.model.ConfigMap import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.client.DefaultKubernetesClient @@ -20,9 +21,11 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { val yamlLoader: YamlLoader val deploymentManager: DeploymentManager val serviceManager: ServiceManager + val configMapManager: ConfigMapManager var ucDeployment: Deployment var ucService: Service var wgDeployment: Deployment + var configMap: ConfigMap init { @@ -32,9 +35,11 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { this.yamlLoader = YamlLoader(this.kubernetesClient) this.deploymentManager = DeploymentManager(this.kubernetesClient) this.serviceManager = ServiceManager(this.kubernetesClient) + this.configMapManager = ConfigMapManager(this.kubernetesClient) ucDeployment = this.yamlLoader.loadDeployment(this.config.ucDeploymentPath) ucService = this.yamlLoader.loadService(this.config.ucServicePath) wgDeployment = this.yamlLoader.loadDeployment(this.config.wgDeploymentPath) + configMap = this.yamlLoader.loadConfigmap(this.config.configMapPath) } override fun clearClusterEnvironment() { @@ -70,13 +75,15 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { this.deploymentManager.setReplica(ucDeployment, resources.get()) this.deploymentManager.setWorkloadEnv(ucDeployment, "uc-application", environmentVariables) + // create kubernetes resources this.deploymentManager.deploy(ucDeployment) this.serviceManager.deploy(ucService) + this.configMapManager.deploy(configMap) } override fun startWorkloadGenerator(load: LoadDimension) { - this.deploymentManager.setImageName(ucDeployment, "workload-generator", this.config.wgImageURL) + this.deploymentManager.setImageName(wgDeployment, "workload-generator", this.config.wgImageURL) // TODO ("calculate number of required instances") @@ -86,13 +93,13 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { environmentVariables.put("ZK_HOST", this.config.zookeeperConnectionString.split(":")[0]) environmentVariables.put("ZK_PORT", this.config.zookeeperConnectionString.split(":")[1]) environmentVariables.put("NUM_SENSORS", load.get().toString()) - environmentVariables.put("NUM_INSTANCES", requiredInstances.toString()) + environmentVariables.put("INSTANCES", requiredInstances.toString()) - logger.info { environmentVariables.toString() } + logger.info { this.config.toString() } + logger.info { this.wgDeployment.toString() } this.deploymentManager.setWorkloadEnv(this.wgDeployment, "workload-generator", environmentVariables) - - logger.info { this.wgDeployment. } + logger.info { this.wgDeployment.toString() } this.deploymentManager.deploy(this.wgDeployment) } @@ -105,6 +112,7 @@ class UC1Benchmark(config: UC1BenchmarkConfig) : Benchmark(config) { val kafkaPartition: Int, val ucDeploymentPath: String, val ucServicePath: String, + val configMapPath: String, val wgDeploymentPath: String, val ucImageURL: String, val wgImageURL: String diff --git a/theodolite-quarkus/src/main/resources/yaml/workloadGenerator.yaml b/theodolite-quarkus/src/main/resources/yaml/workloadGenerator.yaml index 794468b18..242ce5f2d 100644 --- a/theodolite-quarkus/src/main/resources/yaml/workloadGenerator.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/workloadGenerator.yaml @@ -14,25 +14,21 @@ spec: spec: terminationGracePeriodSeconds: 0 containers: - - name: workload-generator - image: workload-generator:latest - env: - # Order need to be preserved for run_uc.py - - name: NUM_SENSORS - value: "25000" - - name: INSTANCES - value: "1" - - name: NUM_NESTED_GROUPS - value: "5" - - name: ZK_HOST - value: "my-confluent-cp-zookeeper" - - name: ZK_PORT - value: "2181" - - name: KAFKA_BOOTSTRAP_SERVERS - value: "my-confluent-cp-kafka:9092" - - name: SCHEMA_REGISTRY_URL - value: "http://my-confluent-cp-schema-registry:8081" - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name + - name: workload-generator + image: workload-generator:latest + env: + # Order need to be preserved for run_uc.py + - name: NUM_SENSORS + value: "25000" + - name: INSTANCES + value: "1" + - name: NUM_NESTED_GROUPS + value: "5" + - name: ZK_HOST + value: "my-confluent-cp-zookeeper" + - name: ZK_PORT + value: "2181" + - name: KAFKA_BOOTSTRAP_SERVERS + value: "my-confluent-cp-kafka:9092" + - name: SCHEMA_REGISTRY_URL + value: "http://my-confluent-cp-schema-registry:8081" \ No newline at end of file -- GitLab