From 41c94097400f263f216727a51ce8469f011a3560 Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Mon, 19 Apr 2021 12:43:07 +0200 Subject: [PATCH] Interpret topic names as a regex string --- .../config/example-benchmark-yaml-resource.yaml | 2 +- theodolite-quarkus/config/example-operator-benchmark.yaml | 4 +++- .../src/main/kotlin/theodolite/k8s/TopicManager.kt | 2 +- .../resources/operator/example-benchmark-k8s-resource.yaml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml index a5f0b16ae..ebc2fe9e4 100644 --- a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml @@ -27,5 +27,5 @@ kafkaConfig: - name: "input" numPartitions: 40 replicationFactor: 1 - - name: "theodolite" + - name: "theodolite-.*" removeOnly: True \ No newline at end of file diff --git a/theodolite-quarkus/config/example-operator-benchmark.yaml b/theodolite-quarkus/config/example-operator-benchmark.yaml index 93b42e869..3ed5218d8 100644 --- a/theodolite-quarkus/config/example-operator-benchmark.yaml +++ b/theodolite-quarkus/config/example-operator-benchmark.yaml @@ -30,4 +30,6 @@ kafkaConfig: topics: - name: "input" numPartitions: 40 - replicationFactor: 1 \ No newline at end of file + replicationFactor: 1 + - name: "theodolite-.*" + removeOnly: True \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt index d58b06fa2..1367f6258 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/TopicManager.kt @@ -70,7 +70,7 @@ class TopicManager(private val kafkaConfig: Map<String, Any>) { */ private fun matchRegex(existingTopic: String, topics: List<String>): Boolean { for (t in topics) { - val regex = ("$t.*").toRegex() + val regex = t.toRegex() if (regex.matches(existingTopic)) { return true } diff --git a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml index 122daec9b..19ec972be 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml @@ -27,5 +27,5 @@ kafkaConfig: - name: "input" numPartitions: 40 replicationFactor: 1 - - name: "theodolite" + - name: "theodolite-.*" removeOnly: True \ No newline at end of file -- GitLab