diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt index 08fdd840dc120f34ab6d303b2013928719c9483c..28a7b12e8b2203496e870fbd67641cd854bbbe0d 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt @@ -3,11 +3,14 @@ package theodolite.benchmark import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.client.NamespacedKubernetesClient import io.quarkus.runtime.annotations.RegisterForReflection +import mu.KotlinLogging import org.apache.kafka.clients.admin.NewTopic import theodolite.k8s.K8sManager import theodolite.k8s.TopicManager import theodolite.util.KafkaConfig +private val logger = KotlinLogging.logger {} + /** * Organizes the deployment of benchmarks in Kubernetes. * @@ -26,7 +29,8 @@ class KubernetesBenchmarkDeployment( ) : BenchmarkDeployment { private val kafkaController = TopicManager(this.kafkaConfig) private val kubernetesManager = K8sManager(client) - private val LABEL = "app.kubernetes.io/name=kafka-lag-exporter" + private val LAG_EXPORTER_POD_LABEL = "app.kubernetes.io/name=kafka-lag-exporter" + private val SLEEP_AFTER_K8S_DELETION_MS = 2000L /** * Setup a [KubernetesBenchmark] using the [TopicManager] and the [K8sManager]: @@ -52,7 +56,9 @@ class KubernetesBenchmarkDeployment( resources.forEach { kubernetesManager.remove(it) } + logger.info { "Kubernetes resources deleted. Allow for short pause before continuing." } + Thread.sleep(SLEEP_AFTER_K8S_DELETION_MS) kafkaController.removeTopics(this.topics.map { topic -> topic.name }) - KafkaLagExporterRemover(client).remove(LABEL) + KafkaLagExporterRemover(client).remove(LAG_EXPORTER_POD_LABEL) } }