Skip to content

Commit 091339a

Browse files
committed
ydbd_slice: review fixes
- --yaml-dynconfig removed - dynconfig.yaml generator fixed ( remove storage only options ) - fix the typo
1 parent 8644423 commit 091339a

File tree

2 files changed

+25
-41
lines changed

2 files changed

+25
-41
lines changed

ydb/tools/ydbd_slice/__init__.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,6 @@ def yaml_config_path_args():
558558
required=False,
559559
help="Path to file with config.yaml configuration",
560560
)
561-
args.add_argument(
562-
"--yaml-dynconfig",
563-
metavar="YAML_DYNCONFIG",
564-
default="",
565-
required=False,
566-
help="Path to file with dynconfig.yaml configuration",
567-
)
568561

569562
return args
570563

@@ -654,14 +647,13 @@ def dispatch_run(func, args, walle_provider, need_confirmation=False):
654647
kikimr_bin, kikimr_compressed_bin = deduce_kikimr_bin_from_args(args)
655648
clear_tmp = not args.dry_run and args.temp_dir is None
656649

657-
if args.yaml_config and args.yaml_dynconfig:
650+
if args.yaml_config:
658651
configurator = yaml_configurator.YamlConfigurator(
659652
args.cluster,
660653
temp_dir,
661654
kikimr_bin,
662655
kikimr_compressed_bin,
663-
args.yaml_config,
664-
args.yaml_dynconfig
656+
args.yaml_config
665657
)
666658
cluster_details = configurator.cluster_description
667659
else:
@@ -1530,28 +1522,19 @@ def main(walle_provider=None):
15301522
if not args.yaml_config:
15311523
warnings.warn(
15321524
'''
1533-
1534-
1535-
###### WARNING #######
1536-
15371525
Using cluster.yaml for cluster configuration is deprecated.
15381526
Only the 'domains' section should be filled with database and slot configurations.
1539-
The config.yaml and dynconfig.yaml should be passed as raw files through the --yaml-config and --yaml-dynconfig parameters.
1527+
The config.yaml should be passed as a raw file through the --yaml-config.
15401528
1541-
ydbd_slice install cluster.yaml all --binary /path/to/ydbd --yaml-config /path/to/config.yaml --yaml-dynconfig /path/to/dynconfig.yaml
1529+
Example:
1530+
ydbd_slice install cluster.yaml all --binary /path/to/ydbd --yaml-config /path/to/config.yaml
15421531
15431532
To save the resulting configuration files from an old cluster.yaml, use the --save-raw-cfg option.
15441533
1534+
Example:
15451535
ydbd_slice install cluster.yaml all --binary /path/to/ydbd --save-raw-cfg /path/to/save
15461536
1547-
The resulting configuration files will be saved in the /path/to/save directory. You can find config.yaml and dynconfig.yaml in the /path/to/save/kikimr-static directory.
1548-
1549-
To generate dynconfig.yaml from config.yaml, you can use the dynconfig-generator command.
1550-
1551-
ydbd_slice dynconfig-generator --yaml-config /path/to/config.yaml --output-file /path/to/dynconfig.yaml
1552-
1553-
###### WARNING #######
1554-
1537+
The resulting configuration files will be saved in the /path/to/save directory. You can find config.yaml in the /path/to/save/kikimr-static directory.
15551538
''',
15561539
DeprecationWarning
15571540
)

ydb/tools/ydbd_slice/yaml_configurator.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
kikimr_cfg_for_static_node_new_style,
1111
)
1212

13+
# Remove specified keys
14+
STORAGE_ONLY_KEYS = [
15+
'static_erasure',
16+
'host_configs',
17+
'nameservice_config',
18+
'blob_storage_config',
19+
'hosts'
20+
]
21+
1322

1423
class YamlConfig(object):
1524
def __init__(self, yaml_config_path: str):
@@ -21,14 +30,19 @@ def __init__(self, yaml_config_path: str):
2130

2231
@property
2332
def dynamic_simple(self):
33+
subconfig = copy.deepcopy(self.__yaml_config)
34+
35+
for key in STORAGE_ONLY_KEYS:
36+
subconfig.pop(key, None)
37+
2438
cluster_uuid = self.__yaml_config.get('nameservice_config', {}).get('cluster_uuid', '')
2539
dynconfig = {
2640
'metadata': {
2741
'kind': 'MainConfig',
2842
'cluster': cluster_uuid,
2943
'version': 0,
3044
},
31-
'config': copy.deepcopy(self.__yaml_config),
45+
'config': subconfig,
3246
'allowed_labels': {
3347
'node_id': {'type': 'string'},
3448
'host': {'type': 'string'},
@@ -48,7 +62,6 @@ def __init__(
4862
bin_path: os.PathLike,
4963
compressed_bin_path: os.PathLike,
5064
config_path: os.PathLike,
51-
dynconfig_path: os.PathLike = ""
5265
):
5366
# walle provider is not used
5467
# use config_path instad of cluster_path
@@ -59,14 +72,12 @@ def __init__(
5972
self.cluster_description.domains = _domains.get('domains', [])
6073

6174
self.__static_cfg = out_dir
75+
# might be needed in the future to do something locally using the ydbd binary
6276
self.__kikimr_bin_file = bin_path
6377
self.__kikimr_compressed_bin_file = compressed_bin_path
6478
with open(config_path, 'r') as f:
6579
self.static = f.read()
6680

67-
with open(dynconfig_path, 'r') as f:
68-
self.dynamic = f.read()
69-
7081
@property
7182
def kikimr_bin(self):
7283
return self.bin_path
@@ -127,7 +138,7 @@ def hosts_names(self):
127138
return [host['host'] for host in self.static_dict.get('hosts', [])]
128139

129140
@property
130-
def kickimr_cfg(self):
141+
def kikimr_cfg(self):
131142
return kikimr_cfg_for_static_node_new_style()
132143

133144
@property
@@ -149,21 +160,11 @@ def create_static_cfg(self) -> str:
149160
)
150161
write_to_file(
151162
os.path.join(self.__static_cfg, 'kikimr.cfg'),
152-
self.kickimr_cfg
153-
)
154-
write_to_file(
155-
os.path.join(self.__static_cfg, 'dynconfig.yaml'),
156-
self.__dynamic
163+
self.kikimr_cfg
157164
)
158165
write_to_file(
159166
os.path.join(self.__static_cfg, 'dynamic_server.cfg'),
160167
self.dynamic_cfg
161168
)
162169

163170
return self.__static_cfg
164-
165-
def create_dynamic_cfg(self) -> str:
166-
write_to_file(
167-
os.path.join(self.__static_cfg, 'dynconfig.yaml'),
168-
self.__dynamic
169-
)

0 commit comments

Comments
 (0)