Skip to content

Commit 07eddfc

Browse files
authored
Use node info from labels in configs dispatcher instead of tenant pool (#11238)
1 parent 7672737 commit 07eddfc

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed

ydb/core/cms/console/configs_dispatcher.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,13 @@ void TConfigsDispatcher::Bootstrap()
301301
CurrentConfig,
302302
0,
303303
true,
304-
1);
304+
1,
305+
{},
306+
{},
307+
TNodeInfo{
308+
.Tenant = Labels.contains("tenant") ? Labels.at("tenant") : TString(""),
309+
.NodeType = Labels.contains("node_type") ? Labels.at("node_type") : TString(""),
310+
});
305311
CommonSubscriptionClient = RegisterWithSameMailbox(commonClient);
306312

307313
Become(&TThis::StateInit);

ydb/core/cms/console/console_configs_subscriber.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
4949
bool processYaml,
5050
ui64 version,
5151
const TString &yamlConfig,
52-
const TMap<ui64, TString> &volatileYamlConfigs)
52+
const TMap<ui64, TString> &volatileYamlConfigs,
53+
const std::optional<TNodeInfo> explicitNodeInfo)
5354
: OwnerId(ownerId)
5455
, Cookie(cookie)
5556
, Kinds(kinds)
@@ -68,6 +69,15 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
6869
VolatileYamlConfigHashes[id] = THash<TString>()(config);
6970
}
7071
}
72+
73+
if (explicitNodeInfo) {
74+
if (explicitNodeInfo->Tenant) {
75+
Tenant = explicitNodeInfo->Tenant;
76+
} else {
77+
Tenant = "<none>";
78+
}
79+
NodeType = explicitNodeInfo->NodeType;
80+
}
7181
}
7282

7383
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
@@ -83,7 +93,11 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
8393
return;
8494
}
8595

86-
SendPoolStatusRequest(ctx);
96+
if (!Tenant) {
97+
SendPoolStatusRequest(ctx);
98+
} else {
99+
Subscribe(ctx);
100+
}
87101
Become(&TThis::StateWork);
88102
}
89103

@@ -418,9 +432,19 @@ IActor *CreateConfigsSubscriber(
418432
bool processYaml,
419433
ui64 version,
420434
const TString &yamlConfig,
421-
const TMap<ui64, TString> &volatileYamlConfigs)
435+
const TMap<ui64, TString> &volatileYamlConfigs,
436+
const std::optional<TNodeInfo> explicitNodeInfo)
422437
{
423-
return new TConfigsSubscriber(ownerId, cookie, kinds, currentConfig, processYaml, version, yamlConfig, volatileYamlConfigs);
438+
return new TConfigsSubscriber(
439+
ownerId,
440+
cookie,
441+
kinds,
442+
currentConfig,
443+
processYaml,
444+
version,
445+
yamlConfig,
446+
volatileYamlConfigs,
447+
explicitNodeInfo);
424448
}
425449

426450
} // namespace NKikimr::NConsole

ydb/core/cms/console/console_configs_subscriber.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66

77
#include <ydb/library/actors/core/actor.h>
88

9+
#include <optional>
10+
911
namespace NKikimr::NConsole {
1012

13+
struct TNodeInfo {
14+
TString Tenant;
15+
TString NodeType;
16+
};
17+
1118
IActor *CreateConfigsSubscriber(
1219
const TActorId &ownerId,
1320
const TVector<ui32> &kinds,
@@ -16,6 +23,7 @@ IActor *CreateConfigsSubscriber(
1623
bool processYaml = false,
1724
ui64 version = 0,
1825
const TString &yamlConfig = {},
19-
const TMap<ui64, TString> &volatileYamlConfigs = {});
26+
const TMap<ui64, TString> &volatileYamlConfigs = {},
27+
const std::optional<TNodeInfo> explicitNodeInfo = std::nullopt);
2028

2129
} // namespace NKikimr::NConsole

ydb/core/cms/console/log_settings_configurator_ut.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,11 @@ Y_UNIT_TEST_SUITE(TLogSettingsConfiguratorTests)
263263

264264
Y_UNIT_TEST(TestRemoveComponentEntries)
265265
{
266-
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
266+
NKikimrConfig::TAppConfig ext;
267+
auto& label = *ext.AddLabels();
268+
label.SetName("tenant");
269+
label.SetValue(TENANT1_1_NAME);
270+
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), ext);
267271
auto settings = InitLogSettingsConfigurator(runtime);
268272
WaitForUpdate(runtime); // initial update
269273

@@ -292,7 +296,11 @@ Y_UNIT_TEST_SUITE(TLogSettingsConfiguratorTests)
292296

293297
Y_UNIT_TEST(TestChangeDefaults)
294298
{
295-
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
299+
NKikimrConfig::TAppConfig ext;
300+
auto& label = *ext.AddLabels();
301+
label.SetName("tenant");
302+
label.SetValue(TENANT1_1_NAME);
303+
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), ext);
296304
auto settings = InitLogSettingsConfigurator(runtime);
297305
WaitForUpdate(runtime); // initial update
298306

0 commit comments

Comments
 (0)