ychris78 opened a new pull request, #7429:
URL: https://github.com/apache/kyuubi/pull/7429
### Why are the changes needed?
Currently, the Kyuubi REST frontend service does not register itself with
the HA discovery service (ZK/ETCD). This means REST clients must use static
host URLs and cannot benefit from dynamic service discovery, automatic
failover, or load balancing that the Thrift frontend already
supports.
This patch adds full service discovery support for the REST frontend,
covering both the **server-side** (registering REST endpoints in ZK/ETCD under
a dedicated namespace) and the **client-side** (discovering and dynamically
refreshing REST endpoints).
**Server-side changes:**
- `KyuubiRestFrontendService` now creates a `KyuubiRestServiceDiscovery`
when HA is configured, registering the REST service under `{namespace}/rest`
(e.g. `/kyuubi/rest`) to distinguish it from Thrift endpoints.
- `KyuubiRestServiceDiscovery` extends `ServiceDiscovery` with custom
namespace logic and graceful shutdown.
- `ServiceDiscovery._namespace` and `_discoveryClient` visibility changed
from `private` to `protected` to allow subclass customization.
**Client-side changes:**
- New `RestDiscoveryConf` configuration class for ZK/ETCD discovery
settings (addresses, namespace, client class, refresh interval).
- New `RestServiceDiscoverer` utility to discover REST host URLs from
ZK/ETCD service nodes.
- `KyuubiRestClient.discoveryBuilder()` API to create a client with
automatic background endpoint refresh.
- `RetryableRestClient` refactored to track the current URI by value
instead of index, with a new `updateUris()` method for dynamic URI list updates.
### How was this patch tested?
- **Unit tests added:**
- `RetryableRestClientTest` — tests `updateUris()` behavior: keeping
current server, switching when removed, URI rotation.
- `RestDiscoveryConfTest` — tests default values, setters, and
validation logic.
- `RestServiceDiscovererTest` — tests namespace construction and
validation.
- **Integration tests added:**
- `KyuubiRestServiceDiscoverySuite` — tests with embedded ZooKeeper:
- REST discovery is conditional on HA configuration.
- REST instance publishes under `namespace/rest` and can be discovered.
- Graceful shutdown when the REST service node is deleted.
- Compiled and tested `kyuubi-ha`, `kyuubi-rest-client`, and
`kyuubi-server` modules (`mvn compile` and `mvn test` all passed).
### Was this patch authored or co-authored using generative AI tooling?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]