Skip to content
Snippets Groups Projects
Commit 782b64fa authored by Sören Henning's avatar Sören Henning
Browse files

Make Kafka config optional

parent d1e83654
No related branches found
No related tags found
1 merge request!228Make Kafka config optional
Pipeline #6144 passed
...@@ -94,13 +94,6 @@ Resource Types: ...@@ -94,13 +94,6 @@ Resource Types:
</tr> </tr>
</thead> </thead>
<tbody><tr> <tbody><tr>
<td><b><a href="#benchmarkspeckafkaconfig">kafkaConfig</a></b></td>
<td>object</td>
<td>
Contains the Kafka configuration.<br/>
</td>
<td>true</td>
</tr><tr>
<td><b><a href="#benchmarkspecloadgenerator">loadGenerator</a></b></td> <td><b><a href="#benchmarkspecloadgenerator">loadGenerator</a></b></td>
<td>object</td> <td>object</td>
<td> <td>
...@@ -138,103 +131,20 @@ Resource Types: ...@@ -138,103 +131,20 @@ Resource Types:
</td> </td>
<td>false</td> <td>false</td>
</tr><tr> </tr><tr>
<td><b>name</b></td> <td><b><a href="#benchmarkspeckafkaconfig">kafkaConfig</a></b></td>
<td>string</td> <td>object</td>
<td> <td>
This field exists only for technical reasons and should not be set by the user. The value of the field will be overwritten.<br/> Contains the Kafka configuration.<br/>
<br/>
<i>Default</i>: <br/>
</td> </td>
<td>false</td> <td>false</td>
</tr></tbody>
</table>
### benchmark.spec.kafkaConfig
<sup><sup>[↩ Parent](#benchmarkspec)</sup></sup>
Contains the Kafka configuration.
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>bootstrapServer</b></td>
<td>string</td>
<td>
The bootstrap servers connection string.<br/>
</td>
<td>true</td>
</tr><tr> </tr><tr>
<td><b><a href="#benchmarkspeckafkaconfigtopicsindex">topics</a></b></td>
<td>[]object</td>
<td>
List of topics to be created for each experiment. Alternative theodolite offers the possibility to remove certain topics after each experiment.<br/>
</td>
<td>true</td>
</tr></tbody>
</table>
### benchmark.spec.kafkaConfig.topics[index]
<sup><sup>[↩ Parent](#benchmarkspeckafkaconfig)</sup></sup>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>name</b></td> <td><b>name</b></td>
<td>string</td> <td>string</td>
<td> <td>
The name of the topic.<br/> This field exists only for technical reasons and should not be set by the user. The value of the field will be overwritten.<br/>
<br/> <br/>
<i>Default</i>: <br/> <i>Default</i>: <br/>
</td> </td>
<td>true</td>
</tr><tr>
<td><b>numPartitions</b></td>
<td>integer</td>
<td>
The number of partitions of the topic.<br/>
<br/>
<i>Default</i>: 0<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>removeOnly</b></td>
<td>boolean</td>
<td>
Determines if this topic should only be deleted after each experiement. For removeOnly topics the name can be a RegEx describing the topic.<br/>
<br/>
<i>Default</i>: false<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>replicationFactor</b></td>
<td>integer</td>
<td>
The replication factor of the topic.<br/>
<br/>
<i>Default</i>: 0<br/>
</td>
<td>false</td> <td>false</td>
</tr></tbody> </tr></tbody>
</table> </table>
...@@ -1647,6 +1557,96 @@ The fileSystem resourceSet loads the Kubernetes manifests from the filesystem. ...@@ -1647,6 +1557,96 @@ The fileSystem resourceSet loads the Kubernetes manifests from the filesystem.
</table> </table>
### benchmark.spec.kafkaConfig
<sup><sup>[↩ Parent](#benchmarkspec)</sup></sup>
Contains the Kafka configuration.
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>bootstrapServer</b></td>
<td>string</td>
<td>
The bootstrap servers connection string.<br/>
</td>
<td>true</td>
</tr><tr>
<td><b><a href="#benchmarkspeckafkaconfigtopicsindex">topics</a></b></td>
<td>[]object</td>
<td>
List of topics to be created for each experiment. Alternative theodolite offers the possibility to remove certain topics after each experiment.<br/>
</td>
<td>true</td>
</tr></tbody>
</table>
### benchmark.spec.kafkaConfig.topics[index]
<sup><sup>[↩ Parent](#benchmarkspeckafkaconfig)</sup></sup>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>name</b></td>
<td>string</td>
<td>
The name of the topic.<br/>
<br/>
<i>Default</i>: <br/>
</td>
<td>true</td>
</tr><tr>
<td><b>numPartitions</b></td>
<td>integer</td>
<td>
The number of partitions of the topic.<br/>
<br/>
<i>Default</i>: 0<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>removeOnly</b></td>
<td>boolean</td>
<td>
Determines if this topic should only be deleted after each experiement. For removeOnly topics the name can be a RegEx describing the topic.<br/>
<br/>
<i>Default</i>: false<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>replicationFactor</b></td>
<td>integer</td>
<td>
The replication factor of the topic.<br/>
<br/>
<i>Default</i>: 0<br/>
</td>
<td>false</td>
</tr></tbody>
</table>
### benchmark.status ### benchmark.status
<sup><sup>[↩ Parent](#benchmark)</sup></sup> <sup><sup>[↩ Parent](#benchmark)</sup></sup>
......
...@@ -20,7 +20,7 @@ spec: ...@@ -20,7 +20,7 @@ spec:
properties: properties:
spec: spec:
type: object type: object
required: ["sut", "loadGenerator", "resourceTypes", "loadTypes", "kafkaConfig"] required: ["sut", "loadGenerator", "resourceTypes", "loadTypes"]
properties: properties:
name: name:
description: This field exists only for technical reasons and should not be set by the user. The value of the field will be overwritten. description: This field exists only for technical reasons and should not be set by the user. The value of the field will be overwritten.
......
...@@ -39,7 +39,7 @@ class KubernetesBenchmark : KubernetesResource, Benchmark { ...@@ -39,7 +39,7 @@ class KubernetesBenchmark : KubernetesResource, Benchmark {
lateinit var name: String lateinit var name: String
lateinit var resourceTypes: List<TypeName> lateinit var resourceTypes: List<TypeName>
lateinit var loadTypes: List<TypeName> lateinit var loadTypes: List<TypeName>
lateinit var kafkaConfig: KafkaConfig var kafkaConfig: KafkaConfig? = null
lateinit var infrastructure: Resources lateinit var infrastructure: Resources
lateinit var sut: Resources lateinit var sut: Resources
lateinit var loadGenerator: Resources lateinit var loadGenerator: Resources
...@@ -110,6 +110,9 @@ class KubernetesBenchmark : KubernetesResource, Benchmark { ...@@ -110,6 +110,9 @@ class KubernetesBenchmark : KubernetesResource, Benchmark {
patcherFactory.createPatcher(it.patcher, appResources + loadGenResources).patch(override.value) patcherFactory.createPatcher(it.patcher, appResources + loadGenResources).patch(override.value)
} }
} }
val kafkaConfig = this.kafkaConfig
return KubernetesBenchmarkDeployment( return KubernetesBenchmarkDeployment(
sutBeforeActions = sut.beforeActions, sutBeforeActions = sut.beforeActions,
sutAfterActions = sut.afterActions, sutAfterActions = sut.afterActions,
...@@ -119,8 +122,8 @@ class KubernetesBenchmark : KubernetesResource, Benchmark { ...@@ -119,8 +122,8 @@ class KubernetesBenchmark : KubernetesResource, Benchmark {
loadGenResources = loadGenResources.map { it.second }, loadGenResources = loadGenResources.map { it.second },
loadGenerationDelay = loadGenerationDelay, loadGenerationDelay = loadGenerationDelay,
afterTeardownDelay = afterTeardownDelay, afterTeardownDelay = afterTeardownDelay,
kafkaConfig = hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer), kafkaConfig = if (kafkaConfig != null) hashMapOf("bootstrap.servers" to kafkaConfig.bootstrapServer) else mapOf(),
topics = kafkaConfig.topics, topics = kafkaConfig?.topics ?: listOf(),
client = this.client client = this.client
) )
} }
......
...@@ -31,7 +31,7 @@ class KubernetesBenchmarkDeployment( ...@@ -31,7 +31,7 @@ class KubernetesBenchmarkDeployment(
val loadGenResources: List<KubernetesResource>, val loadGenResources: List<KubernetesResource>,
private val loadGenerationDelay: Long, private val loadGenerationDelay: Long,
private val afterTeardownDelay: Long, private val afterTeardownDelay: Long,
private val kafkaConfig: HashMap<String, Any>, private val kafkaConfig: Map<String, Any>,
private val topics: List<KafkaConfig.TopicWrapper>, private val topics: List<KafkaConfig.TopicWrapper>,
private val client: NamespacedKubernetesClient private val client: NamespacedKubernetesClient
) : BenchmarkDeployment { ) : BenchmarkDeployment {
...@@ -46,9 +46,12 @@ class KubernetesBenchmarkDeployment( ...@@ -46,9 +46,12 @@ class KubernetesBenchmarkDeployment(
* - Deploy the needed resources. * - Deploy the needed resources.
*/ */
override fun setup() { override fun setup() {
val kafkaTopics = this.topics.filter { !it.removeOnly } if (this.topics.isNotEmpty()) {
val kafkaTopics = this.topics
.filter { !it.removeOnly }
.map { NewTopic(it.name, it.numPartitions, it.replicationFactor) } .map { NewTopic(it.name, it.numPartitions, it.replicationFactor) }
kafkaController.createTopics(kafkaTopics) kafkaController.createTopics(kafkaTopics)
}
sutBeforeActions.forEach { it.exec(client = client) } sutBeforeActions.forEach { it.exec(client = client) }
appResources.forEach { kubernetesManager.deploy(it) } appResources.forEach { kubernetesManager.deploy(it) }
logger.info { "Wait ${this.loadGenerationDelay} seconds before starting the load generator." } logger.info { "Wait ${this.loadGenerationDelay} seconds before starting the load generator." }
...@@ -69,7 +72,9 @@ class KubernetesBenchmarkDeployment( ...@@ -69,7 +72,9 @@ class KubernetesBenchmarkDeployment(
loadGenAfterActions.forEach { it.exec(client = client) } loadGenAfterActions.forEach { it.exec(client = client) }
appResources.forEach { kubernetesManager.remove(it) } appResources.forEach { kubernetesManager.remove(it) }
sutAfterActions.forEach { it.exec(client = client) } sutAfterActions.forEach { it.exec(client = client) }
if (this.topics.isNotEmpty()) {
kafkaController.removeTopics(this.topics.map { topic -> topic.name }) kafkaController.removeTopics(this.topics.map { topic -> topic.name })
}
ResourceByLabelHandler(client).removePods( ResourceByLabelHandler(client).removePods(
labelName = LAG_EXPORTER_POD_LABEL_NAME, labelName = LAG_EXPORTER_POD_LABEL_NAME,
labelValue = LAG_EXPORTER_POD_LABEL_VALUE labelValue = LAG_EXPORTER_POD_LABEL_VALUE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment