diff --git a/docs/docs/schema/defaults.json b/docs/docs/schema/defaults.json index d3dbc7905..cf0e611ad 100644 --- a/docs/docs/schema/defaults.json +++ b/docs/docs/schema/defaults.json @@ -30,7 +30,7 @@ "additionalProperties": false, "description": "Input topic.", "properties": { - "role": { + "label": { "anyOf": [ { "type": "string" @@ -41,7 +41,7 @@ ], "default": null, "description": "Custom identifier belonging to a topic; define only if `type` is `pattern` or `None`", - "title": "Role" + "title": "Label" }, "type": { "anyOf": [ @@ -1688,20 +1688,20 @@ "description": "Key schema class name", "title": "Key schema" }, - "partitions_count": { + "label": { "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Number of partitions into which the topic is divided", - "title": "Partitions count" + "description": "Custom identifier belonging to one or multiple topics, provide only if `type` is `extra`", + "title": "Label" }, - "replication_factor": { + "partitions_count": { "anyOf": [ { "type": "integer" @@ -1711,21 +1711,21 @@ } ], "default": null, - "description": "Replication factor of the topic", - "title": "Replication factor" + "description": "Number of partitions into which the topic is divided", + "title": "Partitions count" }, - "role": { + "replication_factor": { "anyOf": [ { - "type": "string" + "type": "integer" }, { "type": "null" } ], "default": null, - "description": "Custom identifier belonging to one or multiple topics, provide only if `type` is `extra`", - "title": "Role" + "description": "Replication factor of the topic", + "title": "Replication factor" }, "type": { "anyOf": [ diff --git a/docs/docs/schema/pipeline.json b/docs/docs/schema/pipeline.json index 86edc0b8e..c5dbac2af 100644 --- a/docs/docs/schema/pipeline.json +++ b/docs/docs/schema/pipeline.json @@ -30,7 +30,7 @@ "additionalProperties": false, "description": "Input topic.", "properties": { - "role": { + "label": { "anyOf": [ { "type": "string" @@ -41,7 +41,7 @@ ], "default": null, "description": "Custom identifier belonging to a topic; define only if `type` is `pattern` or `None`", - "title": "Role" + "title": "Label" }, "type": { "anyOf": [ @@ -1088,20 +1088,20 @@ "description": "Key schema class name", "title": "Key schema" }, - "partitions_count": { + "label": { "anyOf": [ { - "type": "integer" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Number of partitions into which the topic is divided", - "title": "Partitions count" + "description": "Custom identifier belonging to one or multiple topics, provide only if `type` is `extra`", + "title": "Label" }, - "replication_factor": { + "partitions_count": { "anyOf": [ { "type": "integer" @@ -1111,21 +1111,21 @@ } ], "default": null, - "description": "Replication factor of the topic", - "title": "Replication factor" + "description": "Number of partitions into which the topic is divided", + "title": "Partitions count" }, - "role": { + "replication_factor": { "anyOf": [ { - "type": "string" + "type": "integer" }, { "type": "null" } ], "default": null, - "description": "Custom identifier belonging to one or multiple topics, provide only if `type` is `extra`", - "title": "Role" + "description": "Replication factor of the topic", + "title": "Replication factor" }, "type": { "anyOf": [ diff --git a/examples b/examples index 2e7b20516..608637744 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 2e7b20516fce3658b64789e48fd18c61198456a3 +Subproject commit 60863774413b2eb08bb5d6020432c7f29a944383 diff --git a/kpops/components/base_components/models/from_section.py b/kpops/components/base_components/models/from_section.py index 3f2d5badd..df6d7bd1e 100644 --- a/kpops/components/base_components/models/from_section.py +++ b/kpops/components/base_components/models/from_section.py @@ -23,14 +23,14 @@ class FromTopic(DescConfigModel): """Input topic. :param type: Topic type, defaults to None - :param role: Custom identifier belonging to a topic; + :param label: Custom identifier belonging to a topic; define only if `type` is `pattern` or `None`, defaults to None """ type: InputTopicTypes | None = Field( default=None, description=describe_attr("type", __doc__) ) - role: str | None = Field(default=None, description=describe_attr("role", __doc__)) + label: str | None = Field(default=None, description=describe_attr("label", __doc__)) model_config = ConfigDict( extra="forbid", @@ -38,10 +38,10 @@ class FromTopic(DescConfigModel): ) @model_validator(mode="after") - def extra_topic_role(self) -> Any: - """Ensure that `cls.role` is used correctly, assign type if needed.""" - if self.type == InputTopicTypes.INPUT and self.role: - msg = "Define role only if `type` is `pattern` or `None`" + def extra_topic_label(self) -> Any: + """Ensure that `cls.label` is used correctly, assign type if needed.""" + if self.type == InputTopicTypes.INPUT and self.label: + msg = "Define label only if `type` is `pattern` or `None`" raise ValueError(msg) return self diff --git a/kpops/components/base_components/pipeline_component.py b/kpops/components/base_components/pipeline_component.py index 908a85086..5b6798af6 100644 --- a/kpops/components/base_components/pipeline_component.py +++ b/kpops/components/base_components/pipeline_component.py @@ -74,8 +74,8 @@ def full_name(self) -> str: @property def inputs(self) -> Iterator[KafkaTopic]: yield from self.input_topics - for role_topics in self.extra_input_topics.values(): - yield from role_topics + for labeled_topics in self.extra_input_topics.values(): + yield from labeled_topics @property def outputs(self) -> Iterator[KafkaTopic]: @@ -109,11 +109,11 @@ def add_input_topics(self, topics: list[KafkaTopic]) -> None: :param topics: Input topics """ - def add_extra_input_topics(self, role: str, topics: list[KafkaTopic]) -> None: - """Add given extra topics that share a role to the list of extra input topics. + def add_extra_input_topics(self, label: str, topics: list[KafkaTopic]) -> None: + """Add given extra topics that share a label to the list of extra input topics. :param topics: Extra input topics - :param role: Topic role + :param label: Topic label """ def set_input_pattern(self, name: str) -> None: @@ -122,10 +122,10 @@ def set_input_pattern(self, name: str) -> None: :param name: Input pattern name """ - def add_extra_input_pattern(self, role: str, topic: str) -> None: + def add_extra_input_pattern(self, label: str, topic: str) -> None: """Add an input pattern of type extra. - :param role: Custom identifier belonging to one or multiple topics + :param label: Custom identifier belonging to one or multiple topics :param topic: Topic name """ @@ -141,17 +141,17 @@ def set_error_topic(self, topic: KafkaTopic) -> None: :param topic: Error topic """ - def add_extra_output_topic(self, topic: KafkaTopic, role: str) -> None: + def add_extra_output_topic(self, topic: KafkaTopic, label: str) -> None: """Add an output topic of type extra. :param topic: Output topic - :param role: Role that is unique to the extra output topic + :param label: Label that is unique to the extra output topic """ def set_input_topics(self) -> None: """Put values of config.from into the streams config section of streams bootstrap. - Supports extra_input_topics (topics by role) or input_topics. + Supports extra_input_topics (topics by label) or input_topics. """ if self.from_: for name, topic in self.from_.topics.items(): @@ -165,10 +165,10 @@ def apply_from_inputs(self, name: str, topic: FromTopic) -> None: """ kafka_topic = KafkaTopic(name=name) match topic.type: - case None if topic.role: - self.add_extra_input_topics(topic.role, [kafka_topic]) - case InputTopicTypes.PATTERN if topic.role: - self.add_extra_input_pattern(topic.role, name) + case None if topic.label: + self.add_extra_input_topics(topic.label, [kafka_topic]) + case InputTopicTypes.PATTERN if topic.label: + self.add_extra_input_pattern(topic.label, name) case InputTopicTypes.PATTERN: self.set_input_pattern(name) case _: @@ -177,7 +177,7 @@ def apply_from_inputs(self, name: str, topic: FromTopic) -> None: def set_output_topics(self) -> None: """Put values of `to` section into the producer config section of streams bootstrap. - Supports extra_output_topics (topics by role) or output_topics. + Supports extra_output_topics (topics by label) or output_topics. """ if self.to: for name, topic in self.to.topics.items(): @@ -191,8 +191,8 @@ def apply_to_outputs(self, name: str, topic: TopicConfig) -> None: """ kafka_topic = KafkaTopic(name=name) match topic.type: - case None if topic.role: - self.add_extra_output_topic(kafka_topic, topic.role) + case None if topic.label: + self.add_extra_output_topic(kafka_topic, topic.label) case OutputTopicTypes.ERROR: self.set_error_topic(kafka_topic) case _: @@ -214,7 +214,7 @@ def weave_from_topics( input_topics = [ topic_name for topic_name, topic_config in to.topics.items() - if topic_config.type != OutputTopicTypes.ERROR and not topic_config.role + if topic_config.type != OutputTopicTypes.ERROR and not topic_config.label ] for input_topic in input_topics: self.apply_from_inputs(input_topic, from_topic) diff --git a/kpops/components/common/streams_bootstrap.py b/kpops/components/common/streams_bootstrap.py index 0ac0af5f4..d540d4ded 100644 --- a/kpops/components/common/streams_bootstrap.py +++ b/kpops/components/common/streams_bootstrap.py @@ -71,8 +71,8 @@ def deserialize_extra_output_topics( ) -> dict[str, KafkaTopic] | Any: if isinstance(extra_output_topics, dict): return { - role: KafkaTopic(name=topic_name) - for role, topic_name in extra_output_topics.items() + label: KafkaTopic(name=topic_name) + for label, topic_name in extra_output_topics.items() } return extra_output_topics @@ -80,7 +80,7 @@ def deserialize_extra_output_topics( def serialize_extra_output_topics( self, extra_topics: dict[str, KafkaTopic] ) -> dict[str, str]: - return {role: topic.name for role, topic in extra_topics.items()} + return {label: topic.name for label, topic in extra_topics.items()} # TODO(Ivan Yordanov): Currently hacky and potentially unsafe. Find cleaner solution @pydantic.model_serializer(mode="wrap", when_used="always") diff --git a/kpops/components/common/topic.py b/kpops/components/common/topic.py index 2084aa503..5ce303b84 100644 --- a/kpops/components/common/topic.py +++ b/kpops/components/common/topic.py @@ -31,7 +31,7 @@ class TopicConfig(DescConfigModel): :param partitions_count: Number of partitions into which the topic is divided :param replication_factor: Replication factor of the topic :param configs: Topic configs - :param role: Custom identifier belonging to one or multiple topics, provide only if `type` is `extra` + :param label: Custom identifier belonging to one or multiple topics, provide only if `type` is `extra` """ type: OutputTopicTypes | None = Field( @@ -60,10 +60,7 @@ class TopicConfig(DescConfigModel): configs: dict[str, str | int] = Field( default={}, description=describe_attr("configs", __doc__) ) - # TODO: We can rename this but this would be a breaking change - role: str | None = Field(default=None, description=describe_attr("role", __doc__)) - # TODO: Alternatively, we can define label and use both. Double checks everywhere. - # label: str | None = Field(default=None, description=describe_attr("label", __doc__)) + label: str | None = Field(default=None, description=describe_attr("label", __doc__)) model_config = ConfigDict( extra="forbid", @@ -72,10 +69,10 @@ class TopicConfig(DescConfigModel): ) @model_validator(mode="after") - def extra_topic_role(self) -> Any: - """Ensure that `cls.role` is used correctly, assign type if needed.""" - if self.type and self.role: - msg = "Define `role` only if `type` is undefined" + def extra_topic_label(self) -> Any: + """Ensure that `cls.label` is used correctly, assign type if needed.""" + if self.type and self.label: + msg = "Define `label` only if `type` is undefined" raise ValueError(msg) return self diff --git a/kpops/components/streams_bootstrap/producer/producer_app.py b/kpops/components/streams_bootstrap/producer/producer_app.py index 6964b0244..2e3e8b441 100644 --- a/kpops/components/streams_bootstrap/producer/producer_app.py +++ b/kpops/components/streams_bootstrap/producer/producer_app.py @@ -87,8 +87,8 @@ def set_output_topic(self, topic: KafkaTopic) -> None: self.values.streams.output_topic = topic @override - def add_extra_output_topic(self, topic: KafkaTopic, role: str) -> None: - self.values.streams.extra_output_topics[role] = topic + def add_extra_output_topic(self, topic: KafkaTopic, label: str) -> None: + self.values.streams.extra_output_topics[label] = topic @property @override diff --git a/kpops/components/streams_bootstrap/streams/model.py b/kpops/components/streams_bootstrap/streams/model.py index b3871d4b0..b30f301f9 100644 --- a/kpops/components/streams_bootstrap/streams/model.py +++ b/kpops/components/streams_bootstrap/streams/model.py @@ -68,8 +68,8 @@ def deserialize_extra_input_topics( ) -> dict[str, list[KafkaTopic]] | Any: if isinstance(extra_input_topics, dict): return { - role: [KafkaTopic(name=topic_name) for topic_name in topics] - for role, topics in extra_input_topics.items() + label: [KafkaTopic(name=topic_name) for topic_name in topics] + for label, topics in extra_input_topics.items() } return extra_input_topics @@ -82,7 +82,8 @@ def serialize_extra_input_topics( self, extra_topics: dict[str, list[KafkaTopic]] ) -> dict[str, list[str]]: return { - role: self.serialize_topics(topics) for role, topics in extra_topics.items() + label: self.serialize_topics(topics) + for label, topics in extra_topics.items() } def add_input_topics(self, topics: list[KafkaTopic]) -> None: @@ -94,16 +95,16 @@ def add_input_topics(self, topics: list[KafkaTopic]) -> None: """ self.input_topics = KafkaTopic.deduplicate(self.input_topics + topics) - def add_extra_input_topics(self, role: str, topics: list[KafkaTopic]) -> None: - """Add given extra topics that share a role to the list of extra input topics. + def add_extra_input_topics(self, label: str, topics: list[KafkaTopic]) -> None: + """Add given extra topics that share a label to the list of extra input topics. Ensures no duplicate topics in the list. :param topics: Extra input topics - :param role: Topic role + :param label: Topic label """ - self.extra_input_topics[role] = KafkaTopic.deduplicate( - self.extra_input_topics.get(role, []) + topics + self.extra_input_topics[label] = KafkaTopic.deduplicate( + self.extra_input_topics.get(label, []) + topics ) diff --git a/kpops/components/streams_bootstrap/streams/streams_app.py b/kpops/components/streams_bootstrap/streams/streams_app.py index 67a05a88a..1559b4469 100644 --- a/kpops/components/streams_bootstrap/streams/streams_app.py +++ b/kpops/components/streams_bootstrap/streams/streams_app.py @@ -96,16 +96,16 @@ def add_input_topics(self, topics: list[KafkaTopic]) -> None: self.values.streams.add_input_topics(topics) @override - def add_extra_input_topics(self, role: str, topics: list[KafkaTopic]) -> None: - self.values.streams.add_extra_input_topics(role, topics) + def add_extra_input_topics(self, label: str, topics: list[KafkaTopic]) -> None: + self.values.streams.add_extra_input_topics(label, topics) @override def set_input_pattern(self, name: str) -> None: self.values.streams.input_pattern = name @override - def add_extra_input_pattern(self, role: str, topic: str) -> None: - self.values.streams.extra_input_patterns[role] = topic + def add_extra_input_pattern(self, label: str, topic: str) -> None: + self.values.streams.extra_input_patterns[label] = topic @override def set_output_topic(self, topic: KafkaTopic) -> None: @@ -116,8 +116,8 @@ def set_error_topic(self, topic: KafkaTopic) -> None: self.values.streams.error_topic = topic @override - def add_extra_output_topic(self, topic: KafkaTopic, role: str) -> None: - self.values.streams.extra_output_topics[role] = topic + def add_extra_output_topic(self, topic: KafkaTopic, label: str) -> None: + self.values.streams.extra_output_topics[label] = topic @property @override diff --git a/tests/components/streams_bootstrap_v3/test_producer_app.py b/tests/components/streams_bootstrap_v3/test_producer_app.py index 78964033d..db0de218c 100644 --- a/tests/components/streams_bootstrap_v3/test_producer_app.py +++ b/tests/components/streams_bootstrap_v3/test_producer_app.py @@ -98,7 +98,7 @@ def test_output_topics(self): type=OutputTopicTypes.OUTPUT, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), } @@ -340,7 +340,7 @@ def test_get_output_topics(self): type=OutputTopicTypes.OUTPUT, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), } diff --git a/tests/components/streams_bootstrap_v3/test_streams_app.py b/tests/components/streams_bootstrap_v3/test_streams_app.py index 17b3521ea..2642e38f6 100644 --- a/tests/components/streams_bootstrap_v3/test_streams_app.py +++ b/tests/components/streams_bootstrap_v3/test_streams_app.py @@ -143,13 +143,13 @@ def test_set_topics(self): "example-input": {"type": "input"}, "b": {"type": "input"}, "a": {"type": "input"}, - "topic-extra2": {"role": "role2"}, - "topic-extra3": {"role": "role2"}, - "topic-extra": {"role": "role1"}, + "topic-extra2": {"label": "role2"}, + "topic-extra3": {"label": "role2"}, + "topic-extra": {"label": "role1"}, ".*": {"type": "pattern"}, "example.*": { "type": "pattern", - "role": "another-pattern", + "label": "another-pattern", }, } }, @@ -204,9 +204,9 @@ def test_no_empty_input_topic(self): assert "extraInputPatterns" not in streams_config def test_should_validate(self): - # An exception should be raised when both role and type are defined and type is input + # An exception should be raised when both label and type are defined and type is input with pytest.raises( - ValueError, match="Define role only if `type` is `pattern` or `None`" + ValueError, match="Define label only if `type` is `pattern` or `None`" ): StreamsAppV3( name=STREAMS_APP_NAME, @@ -219,16 +219,16 @@ def test_should_validate(self): "topics": { "topic-input": { "type": "input", - "role": "role", + "label": "role", } } }, }, ) - # An exception should be raised when both role and type are defined and type is error + # An exception should be raised when both label and type are defined and type is error with pytest.raises( - ValueError, match="Define `role` only if `type` is undefined" + ValueError, match="Define `label` only if `type` is undefined" ): StreamsAppV3( name=STREAMS_APP_NAME, @@ -241,7 +241,7 @@ def test_should_validate(self): "topics": { "topic-input": { "type": "error", - "role": "role", + "label": "role", } } }, @@ -265,11 +265,11 @@ def test_set_streams_output_from_to(self): type=OutputTopicTypes.ERROR, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-role", + label="first-extra-role", partitions_count=10, ), "extra-topic-2": TopicConfig( - role="second-extra-role", + label="second-extra-role", partitions_count=10, ), } @@ -341,11 +341,11 @@ async def test_deploy_order_when_dry_run_is_false(self, mocker: MockerFixture): type=OutputTopicTypes.ERROR, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), "extra-topic-2": TopicConfig( - role="second-extra-topic", + label="second-extra-topic", partitions_count=10, ), } @@ -386,14 +386,14 @@ async def test_deploy_order_when_dry_run_is_false(self, mocker: MockerFixture): name="extra-topic-1", config=TopicConfig( partitions_count=10, - role="first-extra-topic", + label="first-extra-topic", ), ), KafkaTopic( name="extra-topic-2", config=TopicConfig( partitions_count=10, - role="second-extra-topic", + label="second-extra-topic", ), ), ] @@ -753,20 +753,20 @@ async def test_get_input_output_topics(self): "example-input": {"type": "input"}, "b": {"type": "input"}, "a": {"type": "input"}, - "topic-extra2": {"role": "role2"}, - "topic-extra3": {"role": "role2"}, - "topic-extra": {"role": "role1"}, + "topic-extra2": {"label": "role2"}, + "topic-extra3": {"label": "role2"}, + "topic-extra": {"label": "role1"}, ".*": {"type": "pattern"}, "example.*": { "type": "pattern", - "role": "another-pattern", + "label": "another-pattern", }, } }, "to": { "topics": { "example-output": {"type": "output"}, - "extra-topic": {"role": "fake-role"}, + "extra-topic": {"label": "fake-role"}, } }, }, diff --git a/tests/components/test_producer_app.py b/tests/components/test_producer_app.py index fc49debf8..aa30177c7 100644 --- a/tests/components/test_producer_app.py +++ b/tests/components/test_producer_app.py @@ -98,7 +98,7 @@ def test_output_topics(self): type=OutputTopicTypes.OUTPUT, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), } @@ -340,7 +340,7 @@ def test_get_output_topics(self): type=OutputTopicTypes.OUTPUT, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), } diff --git a/tests/components/test_streams_app.py b/tests/components/test_streams_app.py index 2703ef8ed..393416027 100644 --- a/tests/components/test_streams_app.py +++ b/tests/components/test_streams_app.py @@ -176,13 +176,13 @@ def test_set_topics(self): "example-input": {"type": "input"}, "b": {"type": "input"}, "a": {"type": "input"}, - "topic-extra2": {"role": "role2"}, - "topic-extra3": {"role": "role2"}, - "topic-extra": {"role": "role1"}, + "topic-extra2": {"label": "role2"}, + "topic-extra3": {"label": "role2"}, + "topic-extra": {"label": "role1"}, ".*": {"type": "pattern"}, "example.*": { "type": "pattern", - "role": "another-pattern", + "label": "another-pattern", }, } }, @@ -237,9 +237,9 @@ def test_no_empty_input_topic(self): assert "extraInputPatterns" not in streams_config def test_should_validate(self): - # An exception should be raised when both role and type are defined and type is input + # An exception should be raised when both label and type are defined and type is input with pytest.raises( - ValueError, match="Define role only if `type` is `pattern` or `None`" + ValueError, match="Define label only if `type` is `pattern` or `None`" ): StreamsApp( name=STREAMS_APP_NAME, @@ -252,16 +252,16 @@ def test_should_validate(self): "topics": { "topic-input": { "type": "input", - "role": "role", + "label": "role", } } }, }, ) - # An exception should be raised when both role and type are defined and type is error + # An exception should be raised when both label and type are defined and type is error with pytest.raises( - ValueError, match="Define `role` only if `type` is undefined" + ValueError, match="Define `label` only if `type` is undefined" ): StreamsApp( name=STREAMS_APP_NAME, @@ -274,7 +274,7 @@ def test_should_validate(self): "topics": { "topic-input": { "type": "error", - "role": "role", + "label": "role", } } }, @@ -298,11 +298,11 @@ def test_set_streams_output_from_to(self): type=OutputTopicTypes.ERROR, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-role", + label="first-extra-role", partitions_count=10, ), "extra-topic-2": TopicConfig( - role="second-extra-role", + label="second-extra-role", partitions_count=10, ), } @@ -374,11 +374,11 @@ async def test_deploy_order_when_dry_run_is_false(self, mocker: MockerFixture): type=OutputTopicTypes.ERROR, partitions_count=10 ), "extra-topic-1": TopicConfig( - role="first-extra-topic", + label="first-extra-topic", partitions_count=10, ), "extra-topic-2": TopicConfig( - role="second-extra-topic", + label="second-extra-topic", partitions_count=10, ), } @@ -419,14 +419,14 @@ async def test_deploy_order_when_dry_run_is_false(self, mocker: MockerFixture): name="extra-topic-1", config=TopicConfig( partitions_count=10, - role="first-extra-topic", + label="first-extra-topic", ), ), KafkaTopic( name="extra-topic-2", config=TopicConfig( partitions_count=10, - role="second-extra-topic", + label="second-extra-topic", ), ), ] @@ -786,20 +786,20 @@ async def test_get_input_output_topics(self): "example-input": {"type": "input"}, "b": {"type": "input"}, "a": {"type": "input"}, - "topic-extra2": {"role": "role2"}, - "topic-extra3": {"role": "role2"}, - "topic-extra": {"role": "role1"}, + "topic-extra2": {"label": "role2"}, + "topic-extra3": {"label": "role2"}, + "topic-extra": {"label": "role1"}, ".*": {"type": "pattern"}, "example.*": { "type": "pattern", - "role": "another-pattern", + "label": "another-pattern", }, } }, "to": { "topics": { "example-output": {"type": "output"}, - "extra-topic": {"role": "fake-role"}, + "extra-topic": {"label": "fake-role"}, } }, }, diff --git a/tests/pipeline/resources/no-input-topic-pipeline/pipeline.yaml b/tests/pipeline/resources/no-input-topic-pipeline/pipeline.yaml index 0edbafc0c..eaea0a4c6 100644 --- a/tests/pipeline/resources/no-input-topic-pipeline/pipeline.yaml +++ b/tests/pipeline/resources/no-input-topic-pipeline/pipeline.yaml @@ -21,6 +21,6 @@ to: topics: example-output-extra: - role: extra + label: extra test-output-extra: - role: test-output + label: test-output diff --git a/tests/pipeline/resources/pipeline-with-short-topics/defaults.yaml b/tests/pipeline/resources/pipeline-with-short-topics/defaults.yaml index 15dc70e01..df6d08c74 100644 --- a/tests/pipeline/resources/pipeline-with-short-topics/defaults.yaml +++ b/tests/pipeline/resources/pipeline-with-short-topics/defaults.yaml @@ -27,15 +27,15 @@ streams-app: # inherits from kafka-app error-topic: type: error extra-topic-output: - role: role + label: role from: topics: input-topic: type: input extra-topic: - role: role + label: role input-pattern: type: pattern extra-pattern: type: pattern - role: role + label: role diff --git a/tests/pipeline/resources/pipeline-with-short-topics/pipeline.yaml b/tests/pipeline/resources/pipeline-with-short-topics/pipeline.yaml index f6db75522..3b2a4b0a5 100644 --- a/tests/pipeline/resources/pipeline-with-short-topics/pipeline.yaml +++ b/tests/pipeline/resources/pipeline-with-short-topics/pipeline.yaml @@ -17,9 +17,9 @@ component-input: type: null component-extra: - role: role + label: role component-input-pattern: type: pattern component-extra-pattern: type: pattern - role: role + label: role diff --git a/tests/pipeline/resources/streams-bootstrap-v3/pipeline.yaml b/tests/pipeline/resources/streams-bootstrap-v3/pipeline.yaml index a22bafd85..54a18341b 100644 --- a/tests/pipeline/resources/streams-bootstrap-v3/pipeline.yaml +++ b/tests/pipeline/resources/streams-bootstrap-v3/pipeline.yaml @@ -10,7 +10,7 @@ my-producer-app-output-topic: type: output my-labeled-producer-app-topic-output: - role: my-producer-app-output-topic-label + label: my-producer-app-output-topic-label - type: my-streams-app @@ -27,12 +27,12 @@ my-input-topic: type: input my-labeled-input-topic: - role: my-input-topic-label + label: my-input-topic-label my-input-pattern: type: pattern my-labeled-input-pattern: type: pattern - role: my-input-topic-labeled-pattern + label: my-input-topic-labeled-pattern to: topics: @@ -41,4 +41,4 @@ my-error-topic: type: error my-labeled-topic-output: - role: my-output-topic-label + label: my-output-topic-label diff --git a/tests/pipeline/snapshots/test_example/test_generate/atm-fraud/pipeline.yaml b/tests/pipeline/snapshots/test_example/test_generate/atm-fraud/pipeline.yaml index 76c9b1bf8..99a7e2cb4 100644 --- a/tests/pipeline/snapshots/test_example/test_generate/atm-fraud/pipeline.yaml +++ b/tests/pipeline/snapshots/test_example/test_generate/atm-fraud/pipeline.yaml @@ -336,7 +336,7 @@ from: components: account-producer: - role: accounts + label: accounts fraud-detector: type: input topics: {} diff --git a/tests/pipeline/snapshots/test_generate/test_inflate_pipeline/pipeline.yaml b/tests/pipeline/snapshots/test_generate/test_inflate_pipeline/pipeline.yaml index 20e133c5f..33a249bbb 100644 --- a/tests/pipeline/snapshots/test_generate/test_inflate_pipeline/pipeline.yaml +++ b/tests/pipeline/snapshots/test_generate/test_inflate_pipeline/pipeline.yaml @@ -291,7 +291,7 @@ type: output should-inflate-inflated-sink-connector: configs: {} - role: test + label: test type: kafka-sink-connector - _cleaner: name: should-inflate-inflated-streams-app diff --git a/tests/pipeline/snapshots/test_generate/test_no_input_topic/pipeline.yaml b/tests/pipeline/snapshots/test_generate/test_no_input_topic/pipeline.yaml index e4af38635..68ca3f287 100644 --- a/tests/pipeline/snapshots/test_generate/test_no_input_topic/pipeline.yaml +++ b/tests/pipeline/snapshots/test_generate/test_no_input_topic/pipeline.yaml @@ -118,7 +118,7 @@ topics: example-output-extra: configs: {} - role: extra + label: extra resources-no-input-topic-pipeline-app2-error: configs: cleanup.policy: compact,delete @@ -127,7 +127,7 @@ value_schema: com.bakdata.kafka.DeadLetter test-output-extra: configs: {} - role: test-output + label: test-output type: streams-app values: imageTag: latest diff --git a/tests/pipeline/snapshots/test_generate/test_read_from_component/pipeline.yaml b/tests/pipeline/snapshots/test_generate/test_read_from_component/pipeline.yaml index 6807b3552..11fd5db4e 100644 --- a/tests/pipeline/snapshots/test_generate/test_read_from_component/pipeline.yaml +++ b/tests/pipeline/snapshots/test_generate/test_read_from_component/pipeline.yaml @@ -205,7 +205,7 @@ topics: inflate-step-inflated-sink-connector: configs: {} - role: test + label: test kafka-sink-connector: configs: {} type: output @@ -399,7 +399,7 @@ topics: inflate-step-without-prefix-inflated-sink-connector: configs: {} - role: test + label: test kafka-sink-connector: configs: {} type: output diff --git a/tests/pipeline/snapshots/test_generate/test_streams_bootstrap_v3/pipeline.yaml b/tests/pipeline/snapshots/test_generate/test_streams_bootstrap_v3/pipeline.yaml index 3d5a7bf9d..ebf90338f 100644 --- a/tests/pipeline/snapshots/test_generate/test_streams_bootstrap_v3/pipeline.yaml +++ b/tests/pipeline/snapshots/test_generate/test_streams_bootstrap_v3/pipeline.yaml @@ -34,7 +34,7 @@ topics: my-labeled-producer-app-topic-output: configs: {} - role: my-producer-app-output-topic-label + label: my-producer-app-output-topic-label my-producer-app-output-topic: configs: {} type: output @@ -97,10 +97,10 @@ my-input-topic: type: input my-labeled-input-pattern: - role: my-input-topic-labeled-pattern + label: my-input-topic-labeled-pattern type: pattern my-labeled-input-topic: - role: my-input-topic-label + label: my-input-topic-label name: my-streams-app namespace: example-namespace prefix: resources-streams-bootstrap-v3- @@ -117,7 +117,7 @@ type: error my-labeled-topic-output: configs: {} - role: my-output-topic-label + label: my-output-topic-label my-output-topic: configs: {} type: output diff --git a/tests/pipeline/test_components/components.py b/tests/pipeline/test_components/components.py index fd3cc08ee..de7d29a97 100644 --- a/tests/pipeline/test_components/components.py +++ b/tests/pipeline/test_components/components.py @@ -56,7 +56,7 @@ def inflate(self) -> list[PipelineComponent]: type=OutputTopicTypes.OUTPUT ), TopicName("${component.name}"): TopicConfig( - type=None, role="test" + type=None, label="test" ), } ), diff --git a/tests/pipeline/test_generate.py b/tests/pipeline/test_generate.py index 184534ad3..25266d3b3 100644 --- a/tests/pipeline/test_generate.py +++ b/tests/pipeline/test_generate.py @@ -595,27 +595,27 @@ def test_short_topic_definition(self): assert "type" not in output_topics["output-topic"] assert output_topics["error-topic"]["type"] == "error" assert "type" not in output_topics["extra-topic-output"] - assert "role" not in output_topics["output-topic"] - assert "role" not in output_topics["error-topic"] - assert output_topics["extra-topic-output"]["role"] == "role" + assert "label" not in output_topics["output-topic"] + assert "label" not in output_topics["error-topic"] + assert output_topics["extra-topic-output"]["label"] == "role" assert "type" not in ["input-topic"] assert "type" not in input_topics["extra-topic"] assert input_topics["input-pattern"]["type"] == "pattern" assert input_topics["extra-pattern"]["type"] == "pattern" - assert "role" not in input_topics["input-topic"] - assert "role" not in input_topics["input-pattern"] - assert input_topics["extra-topic"]["role"] == "role" - assert input_topics["extra-pattern"]["role"] == "role" + assert "label" not in input_topics["input-topic"] + assert "label" not in input_topics["input-pattern"] + assert input_topics["extra-topic"]["label"] == "role" + assert input_topics["extra-pattern"]["label"] == "role" assert "type" not in input_components["component-input"] assert "type" not in input_components["component-extra"] assert input_components["component-input-pattern"]["type"] == "pattern" assert input_components["component-extra-pattern"]["type"] == "pattern" - assert "role" not in input_components["component-input"] - assert "role" not in input_components["component-input-pattern"] - assert input_components["component-extra"]["role"] == "role" - assert input_components["component-extra-pattern"]["role"] == "role" + assert "label" not in input_components["component-input"] + assert "label" not in input_components["component-input-pattern"] + assert input_components["component-extra"]["label"] == "role" + assert input_components["component-extra-pattern"]["label"] == "role" def test_kubernetes_app_name_validation(self): with (