Skip to content

Config option for node registration token #7754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ydb/core/config/init/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class TDefaultNodeBrokerClient
const TGrpcSslSettings& grpcSettings,
const TString addr,
const NYdb::NDiscovery::TNodeRegistrationSettings& settings,
const TString& nodeRegistrationToken,
const IEnv& env)
{
TCommandConfig::TServerEndpoint endpoint = TCommandConfig::ParseServerAddress(addr);
Expand All @@ -210,7 +211,9 @@ class TDefaultNodeBrokerClient
config.UseClientCertificate(certificate.c_str(), privateKey.c_str());
}
}
config.SetAuthToken(BUILTIN_ACL_ROOT);
if (nodeRegistrationToken) {
config.SetAuthToken(nodeRegistrationToken);
}
config.SetEndpoint(endpoint.Address);
auto connection = NYdb::TDriver(config);

Expand All @@ -224,6 +227,7 @@ class TDefaultNodeBrokerClient
const TGrpcSslSettings& grpcSettings,
const TVector<TString>& addrs,
const NYdb::NDiscovery::TNodeRegistrationSettings& settings,
const TString& nodeRegistrationToken,
const IEnv& env,
IInitLogger& logger)
{
Expand All @@ -234,6 +238,7 @@ class TDefaultNodeBrokerClient
result = TryToRegisterDynamicNode(grpcSettings,
addr,
settings,
nodeRegistrationToken,
env);
if (result.IsSuccess()) {
logger.Out() << "Success. Registered as " << result.GetNodeId() << Endl;
Expand Down Expand Up @@ -289,6 +294,7 @@ class TDefaultNodeBrokerClient
NYdb::NDiscovery::TNodeRegistrationResult result = RegisterDynamicNodeImpl(grpcSettings,
addrs,
newRegSettings,
regSettings.NodeRegistrationToken,
env,
logger);

Expand Down
1 change: 1 addition & 0 deletions ydb/core/config/init/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct TNodeRegistrationSettings {
bool FixedNodeID;
ui32 InterconnectPort;
NActors::TNodeLocation Location;
TString NodeRegistrationToken;
};

class INodeRegistrationResult {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/config/init/init_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@ class TInitialConfiguratorImpl
cf.FixedNodeID,
cf.InterconnectPort,
cf.CreateNodeLocation(),
AppConfig.GetAuthConfig().GetNodeRegistrationToken(),
};

auto result = NodeBrokerClient.RegisterDynamicNode(cf.GrpcSslSettings, addrs, settings, Env, Logger);
Expand Down
1 change: 1 addition & 0 deletions ydb/core/protos/auth.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ message TAuthConfig {
optional string AccessServiceType = 79 [default = "Yandex_v2"]; // For now the following values are supported: "Yandex_v2", "Nebius_v1"
optional string CertificateAuthenticationDomain = 80 [default = "cert"];
optional bool EnableLoginAuthentication = 81 [default = true];
optional string NodeRegistrationToken = 82 [default = "root@builtin", (Ydb.sensitive) = true];
Copy link
Collaborator

@ijon ijon Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have made a comment about how it is better to not shove default values into the protobuf specs (for a number of reasons), but... having seen the entire message spec I think its too late.

}

message TUserRegistryConfig {
Expand Down
Loading