nic-6443 opened a new pull request, #13201:
URL: https://github.com/apache/apisix/pull/13201

   ## Summary
   
   Extract composable building blocks from Kubernetes and Nacos discovery 
modules so external consumers can reuse core logic without duplicating internal 
implementation.
   
   ### Changes
   
   **`kubernetes/core.lua`** (new):
   - Config parsing (`get_apiserver`, `setup_namespace_selector`, etc.)
   - Parameterized endpoint callbacks via `create_endpoint_callbacks(options)` 
— supports `key_prefix` for multi-cluster dict isolation and 
`duplicate_port_number` for flexible port key storage
   - Handle factory (`create_handle`) and lifecycle (`start_fetch`) with 
graceful stop
   - Node resolution with LRU cache (`resolve_nodes`)
   - Dict helpers (`dump_endpoints_from_dict`)
   
   **`nacos/client.lua`** (new):
   - Stateless HTTP client (`request`, `get_token_param`)
   - HMAC-SHA1 signing (`get_signed_param`)
   - URL building (`build_base_uri`) with inline credential parsing
   - Instance fetching (`fetch_from_host`) with configurable `key_builder`, 
`preserve_metadata`, and `timeout`
   - Service scanning (`get_nacos_services`) with optional filter callback
   
   **`informer_factory.lua`** enhancements:
   - Graceful stop support via `informer.stop` flag — checked in watch loops, 
list pagination, and before post_list cleanup
   - Configurable `ssl_verify` (from apiserver config, default false)
   - `ssl_server_name` support for HTTPS connections
   
   **`kubernetes/schema.lua`**:
   - Add `ssl_verify` option to service config (single and multiple mode)
   
   Both `init.lua` modules are refactored to use the new building blocks. No 
behavior change for existing users — all public APIs (`init_worker`, `nodes`, 
`dump_data`, `check_discovery_ready`) remain identical.
   
   ### Motivation
   
   This makes the discovery modules more composable. External consumers (e.g., 
dynamic discovery managers that receive registry configs at runtime) can create 
custom handles, reuse endpoint processing callbacks, and build on the Nacos 
HTTP client without duplicating hundreds of lines of internal logic.
   
   ### Testing
   
   All existing `t/discovery/` and `t/kubernetes/discovery/` tests should pass 
without modification.


-- 
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]

Reply via email to