From 4b187bb2965a25d8af56882307be2e29aeed7d89 Mon Sep 17 00:00:00 2001 From: Ramin Gharib Date: Fri, 6 Dec 2024 09:32:49 +0100 Subject: [PATCH] clean ups --- kpops/components/streams_bootstrap/base.py | 17 +++++------------ kpops/manifests/strimzi/kafka_topic.py | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/kpops/components/streams_bootstrap/base.py b/kpops/components/streams_bootstrap/base.py index 55e3daaa6..9fc35e526 100644 --- a/kpops/components/streams_bootstrap/base.py +++ b/kpops/components/streams_bootstrap/base.py @@ -12,7 +12,6 @@ from kpops.component_handlers.helm_wrapper.model import HelmRepoConfig from kpops.components.base_components import KafkaApp from kpops.components.base_components.helm_app import HelmApp -from kpops.components.common.topic import KafkaTopic from kpops.components.streams_bootstrap.model import StreamsBootstrapValues from kpops.manifests.kubernetes import KubernetesManifest from kpops.manifests.strimzi.kafka_topic import StrimziKafkaTopic @@ -90,16 +89,10 @@ def warning_for_latest_image_tag(self) -> Self: def manifest_deploy(self) -> tuple[KubernetesManifest, ...]: resource = super().manifest_deploy() if self.to: - resource = resource + self.manifest_strimzi_topics(self.to.kafka_topics) + resource = resource + tuple( + # TODO: change to cluster_name + StrimziKafkaTopic.from_topic(topic, self.values.kafka.bootstrap_servers) + for topic in self.to.kafka_topics + ) return resource - - def manifest_strimzi_topics( - self, kafka_topics: list[KafkaTopic] - ) -> tuple[StrimziKafkaTopic, ...]: - return tuple( - StrimziKafkaTopic.create_strimzi_topic( - topic, self.values.kafka.bootstrap_servers - ) - for topic in kafka_topics - ) diff --git a/kpops/manifests/strimzi/kafka_topic.py b/kpops/manifests/strimzi/kafka_topic.py index 098ef564f..543e0be2b 100644 --- a/kpops/manifests/strimzi/kafka_topic.py +++ b/kpops/manifests/strimzi/kafka_topic.py @@ -62,12 +62,12 @@ class StrimziKafkaTopic(KubernetesManifest): status: dict[str, Any] | None = None @classmethod - def create_strimzi_topic(cls, topic: KafkaTopic, bootstrap_servers: str) -> Self: + def from_topic(cls, topic: KafkaTopic, cluster_name: str) -> Self: metadata = ObjectMeta.model_validate( { "name": topic.name, "labels": { - "strimzi.io/cluster": bootstrap_servers, + "strimzi.io/cluster": cluster_name, }, } )