Skip to content

Commit

Permalink
clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
raminqaf committed Dec 6, 2024
1 parent 50e81df commit 4b187bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 5 additions & 12 deletions kpops/components/streams_bootstrap/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions kpops/manifests/strimzi/kafka_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
)
Expand Down

0 comments on commit 4b187bb

Please sign in to comment.