Skip to content

Commit fbd9ae2

Browse files
authored
Enable kafka api by env variable (#11892)
1 parent 9bef86a commit fbd9ae2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ydb/public/tools/lib/cmds/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ def deploy(arguments):
359359
if 'YDB_EXPERIMENTAL_PG' in os.environ:
360360
optionals['pg_compatible_expirement'] = True
361361

362+
if _is_env_option_enabled('YDB_KAFKA_API_ENABLED'):
363+
kafka_api_port = int(os.environ.get("YDB_KAFKA_PROXY_PORT", "9092"))
364+
optionals['kafka_api_port'] = kafka_api_port
365+
362366
configuration = KikimrConfigGenerator(
363367
erasure=parse_erasure(arguments),
364368
binary_paths=[arguments.ydb_binary_path] if arguments.ydb_binary_path else None,
@@ -547,3 +551,12 @@ def start_recipe(args):
547551
def stop_recipe(args):
548552
arguments = produce_arguments(args)
549553
cleanup(arguments)
554+
555+
556+
def _is_true_string(s):
557+
s = s.upper()
558+
return s in ['1', 'TRUE', 'YES', 'ON']
559+
560+
561+
def _is_env_option_enabled(name):
562+
return _is_true_string(os.environ.get(name, "FALSE"))

ydb/tests/library/harness/kikimr_config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def __init__(
156156
default_user_sid=None,
157157
pg_compatible_expirement=False,
158158
generic_connector_config=None, # typing.Optional[TGenericConnectorConfig]
159+
kafka_api_port=None,
159160
metadata_section=None,
160161
):
161162
if extra_feature_flags is None:
@@ -431,6 +432,13 @@ def __init__(
431432
self.yaml_config["feature_flags"]["enable_external_data_sources"] = True
432433
self.yaml_config["feature_flags"]["enable_script_execution_operations"] = True
433434

435+
if kafka_api_port is not None:
436+
kafka_proxy_config = dict()
437+
kafka_proxy_config["enable_kafka_proxy"] = True
438+
kafka_proxy_config["listening_port"] = kafka_api_port
439+
440+
self.yaml_config["kafka_proxy_config"] = kafka_proxy_config
441+
434442
self.full_config = dict()
435443
if metadata_section:
436444
self.full_config["metadata"] = metadata_section

0 commit comments

Comments
 (0)