@@ -91,6 +91,7 @@ def __init__(
91
91
"sys.txt" : self .__generate_sys_txt ,
92
92
"tracing.txt" : self .__generate_tracing_txt ,
93
93
# files with default implementation
94
+ "actor_system_config.txt" : None ,
94
95
"sqs.txt" : None ,
95
96
"vdisks.txt" : None ,
96
97
"ic.txt" : None ,
@@ -110,6 +111,7 @@ def __init__(
110
111
"pdisk_key.txt" : None ,
111
112
"immediate_controls_config.txt" : None ,
112
113
"cms_config.txt" : None ,
114
+ "audit_config.txt" : None ,
113
115
}
114
116
self .__optional_config_files = set (
115
117
(
@@ -164,6 +166,10 @@ def domains_txt(self):
164
166
def feature_flags_txt (self ):
165
167
return self .__proto_config ("feature_flags.txt" , feature_flags_pb2 .TFeatureFlags , self .__cluster_details .get_service ("features" ))
166
168
169
+ @property
170
+ def feature_flags_new_txt (self ):
171
+ return self .__proto_config ("feature_flags_new.txt" , feature_flags_pb2 .TFeatureFlags , self .__cluster_details .get_service ("feature_flags" ))
172
+
167
173
@property
168
174
def failure_injection_txt (self ):
169
175
return self .__proto_config (
@@ -248,6 +254,14 @@ def audit_txt(self):
248
254
def audit_txt_enabled (self ):
249
255
return self .__proto_config ("audit.txt" ).ByteSize () > 0
250
256
257
+ @property
258
+ def audit_config_txt (self ):
259
+ return self .__proto_config ("audit_config.txt" , config_pb2 .TAuditConfig , self .__cluster_details .get_service ("audit_config" ))
260
+
261
+ @property
262
+ def audit_config_txt_enabled (self ):
263
+ return self .__proto_config ("audit_config.txt" ).ByteSize () > 0
264
+
251
265
@property
252
266
def fq_txt (self ):
253
267
return self .__proto_config ("fq.txt" , TFederatedQueryConfig , self .__cluster_details .get_service ("yq" ))
@@ -286,6 +300,16 @@ def cms_config_txt(self):
286
300
def cms_config_txt_enabled (self ):
287
301
return self .__proto_config ("cms_config.txt" ).ByteSize () > 0
288
302
303
+ @property
304
+ def actor_system_config_txt (self ):
305
+ return self .__proto_config ("actor_system_config.txt" ,
306
+ config_pb2 .TActorSystemConfig ,
307
+ self .__cluster_details .get_service ("actor_system_config" ))
308
+
309
+ @property
310
+ def actor_system_config_txt_enabled (self ):
311
+ return self .__proto_config ("actor_system_config.txt" ).ByteSize () > 0
312
+
289
313
@property
290
314
def mbus_enabled (self ):
291
315
mbus_config = self .__cluster_details .get_service ("message_bus_config" )
@@ -533,16 +557,16 @@ def get_normalized_config(self):
533
557
if "hive_config" in normalized_config ["domains_config" ]:
534
558
del normalized_config ["domains_config" ]["hive_config" ]
535
559
536
- hostname_to_host_config_id = {node .hostname : node .host_config_id for node in self .__cluster_details .hosts }
560
+ node_to_host_config_id = {( node .hostname , node . port ) : node .host_config_id for node in self .__cluster_details .hosts }
537
561
normalized_config ["hosts" ] = []
538
562
for node in normalized_config ["nameservice_config" ]["node" ]:
539
- if "port" in node and int (node .get ("port" )) == 19001 :
563
+ if "port" in node and int (node .get ("port" )) == base . DEFAULT_INTERCONNECT_PORT :
540
564
del node ["port" ]
541
565
542
566
if "interconnect_host" in node and node ["interconnect_host" ] == node ["host" ]:
543
567
del node ["interconnect_host" ]
544
568
545
- host_config_id = hostname_to_host_config_id [ node ["host" ]]
569
+ host_config_id = node_to_host_config_id [( node ["host" ], node . get ( "port" , base . DEFAULT_INTERCONNECT_PORT )) ]
546
570
if host_config_id is not None :
547
571
node ["host_config_id" ] = host_config_id
548
572
normalized_config ["hosts" ].append (node )
@@ -577,6 +601,9 @@ def get_normalized_config(self):
577
601
if self ._yaml_config_enabled :
578
602
normalized_config ['yaml_config_enabled' ] = True
579
603
604
+ if self .__cluster_details .storage_config_generation is not None :
605
+ normalized_config ["storage_config_generation" ] = int (self .__cluster_details .storage_config_generation )
606
+
580
607
return normalized_config
581
608
582
609
def get_yaml_format_config (self , normalized_config ):
@@ -628,21 +655,24 @@ def get_app_config(self):
628
655
app_config .BlobStorageConfig .CopyFrom (self .bs_txt )
629
656
app_config .ChannelProfileConfig .CopyFrom (self .channels_txt )
630
657
app_config .DomainsConfig .CopyFrom (self .domains_txt )
658
+
659
+ # Old template style:
631
660
if self .feature_flags_txt .ByteSize () > 0 :
632
661
app_config .FeatureFlags .CopyFrom (self .feature_flags_txt )
662
+ # New config.yaml style:
663
+ if self .feature_flags_new_txt .ByteSize () > 0 :
664
+ app_config .FeatureFlags .CopyFrom (self .feature_flags_new_txt )
665
+
633
666
app_config .LogConfig .CopyFrom (self .log_txt )
634
667
if self .auth_txt .ByteSize () > 0 :
635
668
app_config .AuthConfig .CopyFrom (self .auth_txt )
636
669
app_config .KQPConfig .CopyFrom (self .kqp_txt )
637
670
app_config .NameserviceConfig .CopyFrom (self .names_txt )
638
- app_config .ActorSystemConfig .CopyFrom (self .sys_txt )
639
671
app_config .GRpcConfig .CopyFrom (self .grpc_txt )
640
672
app_config .InterconnectConfig .CopyFrom (self .ic_txt )
641
673
app_config .VDiskConfig .CopyFrom (self .vdisks_txt )
642
674
app_config .PQConfig .CopyFrom (self .pq_txt )
643
675
644
- if self .cms_txt .ByteSize () > 0 :
645
- app_config .CmsConfig .CopyFrom (self .cms_txt )
646
676
if self .dyn_ns_txt .ByteSize () > 0 :
647
677
app_config .DynamicNameserviceConfig .CopyFrom (self .dyn_ns_txt )
648
678
if self .pqcd_txt .ByteSize () > 0 :
@@ -653,8 +683,6 @@ def get_app_config(self):
653
683
app_config .ResourceBrokerConfig .CopyFrom (self .rb_txt )
654
684
if self .metering_txt_enabled :
655
685
app_config .MeteringConfig .CopyFrom (self .metering_txt )
656
- if self .audit_txt_enabled :
657
- app_config .AuditConfig .CopyFrom (self .audit_txt )
658
686
if self .fq_txt_enabled :
659
687
app_config .FederatedQueryConfig .CopyFrom (self .fq_txt )
660
688
if self .failure_injection_txt_enabled :
@@ -668,8 +696,26 @@ def get_app_config(self):
668
696
app_config .PDiskKeyConfig .CopyFrom (self .pdisk_key_txt )
669
697
if self .immediate_controls_config_txt_enabled :
670
698
app_config .ImmediateControlsConfig .CopyFrom (self .immediate_controls_config_txt )
699
+
700
+ # Old template style:
701
+ app_config .ActorSystemConfig .CopyFrom (self .sys_txt )
702
+ # New config.yaml style:
703
+ if self .actor_system_config_txt_enabled :
704
+ app_config .ActorSystemConfig .CopyFrom (self .actor_system_config_txt )
705
+
706
+ # Old template style:
707
+ if self .cms_txt .ByteSize () > 0 :
708
+ app_config .CmsConfig .CopyFrom (self .cms_txt )
709
+ # New config.yaml style:
671
710
if self .cms_config_txt_enabled :
672
711
app_config .CmsConfig .CopyFrom (self .cms_config_txt )
712
+
713
+ # Old template style:
714
+ if self .audit_txt_enabled :
715
+ app_config .AuditConfig .CopyFrom (self .audit_txt )
716
+ # New config.yaml style:
717
+ if self .audit_config_txt_enabled :
718
+ app_config .AuditConfig .CopyFrom (self .audit_config_txt )
673
719
return app_config
674
720
675
721
def __proto_config (self , config_file , config_class = None , cluster_details_for_field = None ):
@@ -804,6 +850,11 @@ def __generate_bs_txt(self):
804
850
if drive .expected_slot_count is not None :
805
851
drive_pb .PDiskConfig .ExpectedSlotCount = drive .expected_slot_count
806
852
853
+ # Full support of `pdisk_config`, not just copying selected fields manually
854
+ # from other non-typed locations
855
+ if drive .pdisk_config is not None :
856
+ utils .wrap_parse_dict (drive .pdisk_config , drive_pb .PDiskConfig )
857
+
807
858
assert drive_pb .Guid not in all_guids , "All Guids must be unique!"
808
859
all_guids .add (drive_pb .Guid )
809
860
@@ -1263,9 +1314,12 @@ def __generate_names_txt(self):
1263
1314
utils .wrap_parse_dict (self .__cluster_details .nameservice_config , self .names_txt )
1264
1315
1265
1316
for host in self .__cluster_details .hosts :
1317
+ port = host .port
1318
+ if port is base .DEFAULT_INTERCONNECT_PORT :
1319
+ port = host .ic_port
1266
1320
node = self .names_txt .Node .add (
1267
1321
NodeId = host .node_id ,
1268
- Port = host . ic_port ,
1322
+ Port = port ,
1269
1323
Host = host .hostname ,
1270
1324
InterconnectHost = host .hostname ,
1271
1325
)
@@ -1293,10 +1347,17 @@ def __generate_names_txt(self):
1293
1347
if len (cluster_uuid ) == 0 :
1294
1348
cluster_uuid = self .__cluster_details .cluster_uuid # fall back to `cluster_uuid: ...`
1295
1349
1350
+ # fall back to generated if no cluster uuid is specified at all
1296
1351
cluster_uuid = "ydb:{}" .format (utils .uuid ()) if cluster_uuid is None else cluster_uuid
1352
+
1297
1353
self .names_txt .ClusterUUID = cluster_uuid
1298
- self .names_txt .AcceptUUID .append (cluster_uuid )
1299
- self .names_txt .AcceptUUID .extend (accepted_uuids )
1354
+ accepted_uuids .append (cluster_uuid )
1355
+
1356
+ # combine accept uuids from all possible sources: old format, new format, and filter unique
1357
+ existing_set = set (self .names_txt .AcceptUUID )
1358
+ new_set = set (accepted_uuids )
1359
+ unique_elements = existing_set .union (new_set )
1360
+ self .names_txt .AcceptUUID [:] = unique_elements
1300
1361
1301
1362
def __generate_sys_txt (self ):
1302
1363
self .__proto_configs ["sys.txt" ] = config_pb2 .TActorSystemConfig ()
0 commit comments