diff options
| author | nadya73 <[email protected]> | 2025-04-06 19:55:20 +0300 |
|---|---|---|
| committer | nadya73 <[email protected]> | 2025-04-06 20:07:16 +0300 |
| commit | 4638675a7847697481d1c1af97b6c3992c29d2af (patch) | |
| tree | 32d9b21061e35f6fc8a20cd31382ca2294f42812 | |
| parent | fa92f68e7b59af5be219d46bd63ee609e4122b69 (diff) | |
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
| -rw-r--r-- | yt/yt/client/api/rpc_proxy/public.h | 4 | ||||
| -rw-r--r-- | yt/yt/client/driver/etc_commands.cpp | 20 | ||||
| -rw-r--r-- | yt/yt/client/driver/etc_commands.h | 4 | ||||
| -rw-r--r-- | yt/yt/client/driver/proxy_discovery_cache.cpp | 4 |
4 files changed, 24 insertions, 8 deletions
diff --git a/yt/yt/client/api/rpc_proxy/public.h b/yt/yt/client/api/rpc_proxy/public.h index cf825ad99e2..982cf5bf5ae 100644 --- a/yt/yt/client/api/rpc_proxy/public.h +++ b/yt/yt/client/api/rpc_proxy/public.h @@ -36,6 +36,10 @@ DEFINE_ENUM(EAddressType, ((InternalRpc) (0)) ((MonitoringHttp) (1)) ((TvmOnlyInternalRpc) (2)) + ((Http) (3)) + ((Https) (4)) + ((TvmOnlyHttp) (5)) + ((TvmOnlyHttps) (6)) ); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/driver/etc_commands.cpp b/yt/yt/client/driver/etc_commands.cpp index debe2a3ffc5..fbcc08f7226 100644 --- a/yt/yt/client/driver/etc_commands.cpp +++ b/yt/yt/client/driver/etc_commands.cpp @@ -412,21 +412,31 @@ void TDiscoverProxiesCommand::Register(TRegistrar registrar) .Alias("type") .Default(EProxyKind::Rpc); registrar.Parameter("role", &TThis::Role) - .Default(DefaultRpcProxyRole); + .Optional();; registrar.Parameter("address_type", &TThis::AddressType) - .Default(NApi::NRpcProxy::DefaultAddressType); + .Optional();; registrar.Parameter("network_name", &TThis::NetworkName) - .Default(NApi::NRpcProxy::DefaultNetworkName); + .Default(NRpcProxy::DefaultNetworkName); registrar.Parameter("ignore_balancers", &TThis::IgnoreBalancers) .Default(false); + + registrar.Postprocessor([] (TThis* config) { + if (config->Kind == EProxyKind::Http) { + config->Role = config->Role.value_or(DefaultHttpProxyRole); + config->AddressType = config->AddressType.value_or(NRpcProxy::EAddressType::Http); + } else { + config->Role = config->Role.value_or(DefaultRpcProxyRole); + config->AddressType = config->AddressType.value_or(NRpcProxy::DefaultAddressType); + } + }); } void TDiscoverProxiesCommand::DoExecute(ICommandContextPtr context) { TProxyDiscoveryRequest request{ .Kind = Kind, - .Role = Role, - .AddressType = AddressType, + .Role = Role.value_or(DefaultRpcProxyRole), + .AddressType = AddressType.value_or(NRpcProxy::DefaultAddressType), .NetworkName = NetworkName, .IgnoreBalancers = IgnoreBalancers, }; diff --git a/yt/yt/client/driver/etc_commands.h b/yt/yt/client/driver/etc_commands.h index f51670a95eb..6ab7034491c 100644 --- a/yt/yt/client/driver/etc_commands.h +++ b/yt/yt/client/driver/etc_commands.h @@ -231,8 +231,8 @@ public: private: NApi::EProxyKind Kind; - std::string Role; - NApi::NRpcProxy::EAddressType AddressType; + std::optional<std::string> Role; + std::optional<NApi::NRpcProxy::EAddressType> AddressType; std::string NetworkName; bool IgnoreBalancers; diff --git a/yt/yt/client/driver/proxy_discovery_cache.cpp b/yt/yt/client/driver/proxy_discovery_cache.cpp index e025f59105e..e69e60f9789 100644 --- a/yt/yt/client/driver/proxy_discovery_cache.cpp +++ b/yt/yt/client/driver/proxy_discovery_cache.cpp @@ -157,7 +157,7 @@ private: if (address) { response.Addresses.push_back(*address); } else { - // COMPAT(verytable): Drop it after all rpc proxies migrate to 22.3. + // COMPAT(nadya73): Drop it after all http proxies migrate to 25.2. if (!proxyNode->Attributes().Contains(AddressesAttributeName)) { response.Addresses.push_back(proxyAddress); } @@ -175,6 +175,8 @@ private: return RpcProxiesPath; case EProxyKind::Grpc: return GrpcProxiesPath; + case EProxyKind::Http: + return HttpProxiesPath; default: THROW_ERROR_EXCEPTION("Proxy type %Qlv is not supported", type); |
