Skip to content

Commit afbd118

Browse files
authored
[stable-24-3] Use node info from labels in configs dispatcher instead of tenant pool (#11491)
1 parent 64f4d39 commit afbd118

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
@@ -300,7 +300,13 @@ void TConfigsDispatcher::Bootstrap()
300300
CurrentConfig,
301301
0,
302302
true,
303-
1);
303+
1,
304+
{},
305+
{},
306+
TNodeInfo{
307+
.Tenant = Labels.contains("tenant") ? Labels.at("tenant") : TString(""),
308+
.NodeType = Labels.contains("node_type") ? Labels.at("node_type") : TString(""),
309+
});
304310
CommonSubscriptionClient = RegisterWithSameMailbox(commonClient);
305311

306312
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
@@ -48,7 +48,8 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
4848
bool processYaml,
4949
ui64 version,
5050
const TString &yamlConfig,
51-
const TMap<ui64, TString> &volatileYamlConfigs)
51+
const TMap<ui64, TString> &volatileYamlConfigs,
52+
const std::optional<TNodeInfo> explicitNodeInfo)
5253
: OwnerId(ownerId)
5354
, Cookie(cookie)
5455
, Kinds(kinds)
@@ -67,6 +68,15 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
6768
VolatileYamlConfigHashes[id] = THash<TString>()(config);
6869
}
6970
}
71+
72+
if (explicitNodeInfo) {
73+
if (explicitNodeInfo->Tenant) {
74+
Tenant = explicitNodeInfo->Tenant;
75+
} else {
76+
Tenant = "<none>";
77+
}
78+
NodeType = explicitNodeInfo->NodeType;
79+
}
7080
}
7181

7282
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
@@ -82,7 +92,11 @@ class TConfigsSubscriber : public TActorBootstrapped<TConfigsSubscriber> {
8292
return;
8393
}
8494

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

@@ -417,9 +431,19 @@ IActor *CreateConfigsSubscriber(
417431
bool processYaml,
418432
ui64 version,
419433
const TString &yamlConfig,
420-
const TMap<ui64, TString> &volatileYamlConfigs)
434+
const TMap<ui64, TString> &volatileYamlConfigs,
435+
const std::optional<TNodeInfo> explicitNodeInfo)
421436
{
422-
return new TConfigsSubscriber(ownerId, cookie, kinds, currentConfig, processYaml, version, yamlConfig, volatileYamlConfigs);
437+
return new TConfigsSubscriber(
438+
ownerId,
439+
cookie,
440+
kinds,
441+
currentConfig,
442+
processYaml,
443+
version,
444+
yamlConfig,
445+
volatileYamlConfigs,
446+
explicitNodeInfo);
423447
}
424448

425449
} // 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)