Skip to content

Commit 4638675

Browse files
committed
YT-23887: Support http proxies in discover_proxies handler
* Changelog entry Type: feature Component: proxy Support HTTP proxies in `discover_proxies` handler commit_hash:05fc624699785c3a54ec18f8d0a9f315d723f254
1 parent fa92f68 commit 4638675

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

yt/yt/client/api/rpc_proxy/public.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ DEFINE_ENUM(EAddressType,
3636
((InternalRpc) (0))
3737
((MonitoringHttp) (1))
3838
((TvmOnlyInternalRpc) (2))
39+
((Http) (3))
40+
((Https) (4))
41+
((TvmOnlyHttp) (5))
42+
((TvmOnlyHttps) (6))
3943
);
4044

4145
////////////////////////////////////////////////////////////////////////////////

yt/yt/client/driver/etc_commands.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,21 +412,31 @@ void TDiscoverProxiesCommand::Register(TRegistrar registrar)
412412
.Alias("type")
413413
.Default(EProxyKind::Rpc);
414414
registrar.Parameter("role", &TThis::Role)
415-
.Default(DefaultRpcProxyRole);
415+
.Optional();;
416416
registrar.Parameter("address_type", &TThis::AddressType)
417-
.Default(NApi::NRpcProxy::DefaultAddressType);
417+
.Optional();;
418418
registrar.Parameter("network_name", &TThis::NetworkName)
419-
.Default(NApi::NRpcProxy::DefaultNetworkName);
419+
.Default(NRpcProxy::DefaultNetworkName);
420420
registrar.Parameter("ignore_balancers", &TThis::IgnoreBalancers)
421421
.Default(false);
422+
423+
registrar.Postprocessor([] (TThis* config) {
424+
if (config->Kind == EProxyKind::Http) {
425+
config->Role = config->Role.value_or(DefaultHttpProxyRole);
426+
config->AddressType = config->AddressType.value_or(NRpcProxy::EAddressType::Http);
427+
} else {
428+
config->Role = config->Role.value_or(DefaultRpcProxyRole);
429+
config->AddressType = config->AddressType.value_or(NRpcProxy::DefaultAddressType);
430+
}
431+
});
422432
}
423433

424434
void TDiscoverProxiesCommand::DoExecute(ICommandContextPtr context)
425435
{
426436
TProxyDiscoveryRequest request{
427437
.Kind = Kind,
428-
.Role = Role,
429-
.AddressType = AddressType,
438+
.Role = Role.value_or(DefaultRpcProxyRole),
439+
.AddressType = AddressType.value_or(NRpcProxy::DefaultAddressType),
430440
.NetworkName = NetworkName,
431441
.IgnoreBalancers = IgnoreBalancers,
432442
};

yt/yt/client/driver/etc_commands.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ class TDiscoverProxiesCommand
231231

232232
private:
233233
NApi::EProxyKind Kind;
234-
std::string Role;
235-
NApi::NRpcProxy::EAddressType AddressType;
234+
std::optional<std::string> Role;
235+
std::optional<NApi::NRpcProxy::EAddressType> AddressType;
236236
std::string NetworkName;
237237
bool IgnoreBalancers;
238238

yt/yt/client/driver/proxy_discovery_cache.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class TProxyDiscoveryCache
157157
if (address) {
158158
response.Addresses.push_back(*address);
159159
} else {
160-
// COMPAT(verytable): Drop it after all rpc proxies migrate to 22.3.
160+
// COMPAT(nadya73): Drop it after all http proxies migrate to 25.2.
161161
if (!proxyNode->Attributes().Contains(AddressesAttributeName)) {
162162
response.Addresses.push_back(proxyAddress);
163163
}
@@ -175,6 +175,8 @@ class TProxyDiscoveryCache
175175
return RpcProxiesPath;
176176
case EProxyKind::Grpc:
177177
return GrpcProxiesPath;
178+
case EProxyKind::Http:
179+
return HttpProxiesPath;
178180
default:
179181
THROW_ERROR_EXCEPTION("Proxy type %Qlv is not supported",
180182
type);

0 commit comments

Comments
 (0)