Skip to content

Commit

Permalink
Remove default filename prefix from KPOps config (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
raminqaf authored May 28, 2024
1 parent 42d59d3 commit f28c8d6
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 30 deletions.
2 changes: 0 additions & 2 deletions docs/docs/resources/pipeline-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ pipeline_base_dir: .
# The Kafka brokers address.
# REQUIRED
kafka_brokers: "http://broker1:9092,http://broker2:9092"
# The name of the defaults file and the prefix of the defaults environment file.
defaults_filename_prefix: defaults
# Configure the topic name variables you can use in the pipeline definition.
topic_name_config:
# Configures the value for the variable ${output_topic_name}
Expand Down
4 changes: 0 additions & 4 deletions docs/docs/resources/variables/config_env_vars.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ KPOPS_PIPELINE_BASE_DIR=.
# kafka_brokers
# The comma separated Kafka brokers address.
KPOPS_KAFKA_BROKERS # No default value, required
# defaults_filename_prefix
# The name of the defaults file and the prefix of the defaults
# environment file.
KPOPS_DEFAULTS_FILENAME_PREFIX=defaults
# topic_name_config.default_output_topic_name
# Configures the value for the variable ${output_topic_name}
KPOPS_TOPIC_NAME_CONFIG__DEFAULT_OUTPUT_TOPIC_NAME=${pipeline.name}-${component.name}
Expand Down
1 change: 0 additions & 1 deletion docs/docs/resources/variables/config_env_vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ These variables take precedence over the settings in `config.yaml`. Variables ma
|KPOPS_COMPONENTS_MODULE | |False |Custom Python module defining project-specific KPOps components |components_module |
|KPOPS_PIPELINE_BASE_DIR |. |False |Base directory to the pipelines (default is current working directory) |pipeline_base_dir |
|KPOPS_KAFKA_BROKERS | |True |The comma separated Kafka brokers address. |kafka_brokers |
|KPOPS_DEFAULTS_FILENAME_PREFIX |defaults |False |The name of the defaults file and the prefix of the defaults environment file. |defaults_filename_prefix |
|KPOPS_TOPIC_NAME_CONFIG__DEFAULT_OUTPUT_TOPIC_NAME|${pipeline.name}-${component.name} |False |Configures the value for the variable ${output_topic_name} |topic_name_config.default_output_topic_name|
|KPOPS_TOPIC_NAME_CONFIG__DEFAULT_ERROR_TOPIC_NAME |${pipeline.name}-${component.name}-error|False |Configures the value for the variable ${error_topic_name} |topic_name_config.default_error_topic_name |
|KPOPS_SCHEMA_REGISTRY__ENABLED |False |False |Whether the Schema Registry handler should be initialized. |schema_registry.enabled |
Expand Down
6 changes: 0 additions & 6 deletions docs/docs/schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@
"title": "Create Namespace",
"type": "boolean"
},
"defaults_filename_prefix": {
"default": "defaults",
"description": "The name of the defaults file and the prefix of the defaults environment file.",
"title": "Defaults Filename Prefix",
"type": "string"
},
"helm_config": {
"allOf": [
{
Expand Down
7 changes: 0 additions & 7 deletions docs/docs/user/core-concepts/defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ It is important to note that `defaults_{environment}.yaml` overrides only the se

<!-- dprint-ignore-end -->

<!-- dprint-ignore-start -->

!!! tip
`defaults` is the default value of `defaults_filename_prefix`.

<!-- dprint-ignore-end -->

## Components

<!-- When possible, automatically generate a list of all component-specific settings under each component. -->
Expand Down
8 changes: 4 additions & 4 deletions kpops/components/base_components/base_defaults_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)
from pydantic.json_schema import SkipJsonSchema

from kpops.api.file_type import KpopsFileType
from kpops.component_handlers import ComponentHandlers
from kpops.config import KpopsConfig
from kpops.utils import cached_classproperty
Expand Down Expand Up @@ -256,8 +257,7 @@ def get_defaults_file_paths(
associated with the pipeline.
:param pipeline_path: The path to the pipeline.yaml file.
:param config: The KPOps configuration object containing settings such as pipeline_base_dir
and defaults_filename_prefix.
:param config: The KPOps configuration object containing settings such as pipeline_base_dir.
:param environment: Optional. The environment for which default configuration files are sought.
:returns: A list of Path objects representing the default configuration file paths.
"""
Expand All @@ -274,12 +274,12 @@ def get_defaults_file_paths(
raise RuntimeError(message)
while pipeline_base_dir != path:
environment_default_file_path = (
path.parent / f"{config.defaults_filename_prefix}_{environment}.yaml"
path.parent / KpopsFileType.DEFAULTS.as_yaml_file(suffix=f"_{environment}")
)
if environment_default_file_path.is_file():
default_paths.append(environment_default_file_path)

defaults_yaml_path = path.parent / f"{config.defaults_filename_prefix}.yaml"
defaults_yaml_path = path.parent / KpopsFileType.DEFAULTS.as_yaml_file()
if defaults_yaml_path.is_file():
default_paths.append(defaults_yaml_path)

Expand Down
4 changes: 0 additions & 4 deletions kpops/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ class KpopsConfig(BaseSettings):
],
description="The comma separated Kafka brokers address.",
)
defaults_filename_prefix: str = Field(
default="defaults",
description="The name of the defaults file and the prefix of the defaults environment file.",
)
topic_name_config: TopicNameConfig = Field(
default=TopicNameConfig(),
description=describe_object(TopicNameConfig.__doc__),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ kafka_brokers: null
# Non-required fields
components_module: null
create_namespace: false
defaults_filename_prefix: defaults
helm_config:
api_version: null
context: null
Expand Down
1 change: 0 additions & 1 deletion tests/test_kpops_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
def test_kpops_config_with_default_values():
default_config = KpopsConfig(kafka_brokers="http://broker:9092")

assert default_config.defaults_filename_prefix == "defaults"
assert (
default_config.topic_name_config.default_output_topic_name
== "${pipeline.name}-${component.name}"
Expand Down

0 comments on commit f28c8d6

Please sign in to comment.