Copilot commented on code in PR #13201:
URL: https://github.com/apache/apisix/pull/13201#discussion_r3067549370


##########
apisix/discovery/kubernetes/init.lua:
##########
@@ -563,71 +74,26 @@ local function single_mode_init(conf)
         return
     end
 
-    local apiserver, err = get_apiserver(conf)
-    if err then
-        error(err)
-        return
-    end
-
-    local default_weight = conf.default_weight
-    local endpoints_informer, err
-    if conf.watch_endpoint_slices then
-        endpoints_informer, err = informer_factory.new("discovery.k8s.io", 
"v1",
-                                                       "EndpointSlice", 
"endpointslices", "")
-    else
-        endpoints_informer, err = informer_factory.new("", "v1", "Endpoints", 
"endpoints", "")
-    end
+    local handle, err = k8s_core.create_handle(conf, {
+        endpoint_dict = endpoint_dict,
+    })
     if err then
         error(err)
         return
     end
 
-    setup_namespace_selector(conf, endpoints_informer)
-    setup_label_selector(conf, endpoints_informer)
-
-    if conf.watch_endpoint_slices then
-        endpoints_informer.on_added = on_endpoint_slices_modified
-        endpoints_informer.on_modified = on_endpoint_slices_modified
-        endpoints_informer.on_deleted = on_endpoint_slices_deleted
-        endpoints_informer.endpoint_slices_cache = {}
-    else
-        endpoints_informer.on_added = on_endpoint_modified
-        endpoints_informer.on_modified = on_endpoint_modified
-        endpoints_informer.on_deleted = on_endpoint_deleted
-    end
-
-    endpoints_informer.pre_list = pre_list
-    endpoints_informer.post_list = post_list
-
-    ctx = setmetatable({
-        endpoint_dict = endpoint_dict,
-        apiserver = apiserver,
-        default_weight = default_weight
-    }, { __index = endpoints_informer })
-
-    start_fetch(ctx)
+    ctx = handle
+    k8s_core.start_fetch(ctx)
 end
 
 
 local function single_mode_nodes(service_name)
-    local pattern = "^(.*):(.*)$" -- namespace/name:port_name
-    local match = ngx.re.match(service_name, pattern, "jo")
-    if not match then
-        core.log.error("get unexpected upstream service_name: ", service_name)
-        return nil
-    end
-
-    local endpoint_dict = ctx
-    local endpoint_key = match[1]
-    local endpoint_port = match[2]
-    local endpoint_version = endpoint_dict:get(endpoint_key .. "#version")
-    if not endpoint_version then
-        core.log.info("get empty endpoint version from discovery DICT ", 
endpoint_key)
-        return nil
-    end
-
-    return endpoint_lrucache(service_name, endpoint_version,
-            create_endpoint_lrucache, endpoint_dict, endpoint_key, 
endpoint_port)
+    return k8s_core.resolve_nodes(
+        endpoint_lrucache, service_name,
+        "^(.*):(.*)$",   -- namespace/name:port_name
+        function(match)
+            return ctx, match[1], match[2]

Review Comment:
   In the privileged-agent process `ctx` is set to the discovery handle (not 
the shared dict). `k8s_core.resolve_nodes` expects an `endpoint_dict` with a 
`:get()` method, so calling `nodes()` in that process would error. Consider 
returning `ctx.endpoint_dict` when present (fallback to `ctx` in worker 
processes) to keep `nodes()` safe in all process types.



##########
apisix/discovery/kubernetes/core.lua:
##########
@@ -0,0 +1,739 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+--- Reusable building blocks for Kubernetes service discovery.
+--- Extracted from init.lua so that both static-config mode and
+--- dynamic-config mode can share the same core logic.
+
+local ngx          = ngx
+local ipairs        = ipairs
+local pairs         = pairs
+local type          = type
+local unpack        = unpack
+local string        = string
+local tonumber      = tonumber
+local tostring      = tostring
+local os            = os
+local pcall         = pcall
+local setmetatable  = setmetatable
+
+local core = require("apisix.core")
+local util = require("apisix.cli.util")
+local default_informer_factory = 
require("apisix.discovery.kubernetes.informer_factory")
+
+
+local _M = {}
+
+local endpoint_buffer = {}
+local kubernetes_service_name_label = "kubernetes.io/service-name"
+
+
+-- ─── helpers ──────────────────────────────────────────────────────────
+
+local function sort_nodes_cmp(left, right)
+    if left.host ~= right.host then
+        return left.host < right.host
+    end
+    return left.port < right.port
+end
+
+
+local function build_endpoint_key(key_prefix, namespace, name)
+    if key_prefix and key_prefix ~= "" then
+        return key_prefix .. "/" .. namespace .. "/" .. name
+    end
+    return namespace .. "/" .. name
+end
+
+
+-- ─── config parsing (exported) ────────────────────────────────────────
+
+function _M.read_env(key)
+    if #key > 3 then
+        local first, second = string.byte(key, 1, 2)
+        if first == string.byte('$') and second == string.byte('{') then
+            local last = string.byte(key, #key)
+            if last == string.byte('}') then
+                local env = string.sub(key, 3, #key - 1)
+                local value = os.getenv(env)
+                if not value then
+                    return nil, "not found environment variable " .. env
+                end
+                return value
+            end
+        end
+    end
+    return key
+end
+
+
+function _M.read_token(token_file)
+    local token, err = util.read_file(token_file)
+    if err then
+        return nil, err
+    end
+    return util.trim(token)
+end
+
+
+function _M.get_apiserver(conf)
+    local apiserver = {
+        schema = "",
+        host   = "",
+        port   = "",
+    }
+
+    apiserver.schema = conf.service.schema
+    if apiserver.schema ~= "http" and apiserver.schema ~= "https" then
+        return nil, "service.schema should set to one of [http,https] but " .. 
apiserver.schema
+    end
+
+    local err
+    apiserver.host, err = _M.read_env(conf.service.host)
+    if err then
+        return nil, err
+    end
+    if apiserver.host == "" then
+        return nil, "service.host should set to non-empty string"
+    end
+
+    local port
+    port, err = _M.read_env(conf.service.port)
+    if err then
+        return nil, err
+    end
+    apiserver.port = tonumber(port)
+    if not apiserver.port or apiserver.port <= 0 or apiserver.port > 65535 then
+        return nil, "invalid port value: " .. (apiserver.port or "nil")
+    end
+
+    if conf.client.token then
+        local token
+        token, err = _M.read_env(conf.client.token)
+        if err then
+            return nil, err
+        end
+        apiserver.token = util.trim(token)
+    elseif conf.client.token_file and conf.client.token_file ~= "" then
+        setmetatable(apiserver, {
+            __index = function(_, key)
+                if key ~= "token" then
+                    return
+                end
+                local token_file
+                token_file, err = _M.read_env(conf.client.token_file)
+                if err then
+                    core.log.error("failed to read token file path: ", err)
+                    return
+                end
+                local token
+                token, err = _M.read_token(token_file)
+                if err then
+                    core.log.error("failed to read token from file: ", err)
+                    return
+                end
+                core.log.debug("re-read the token value")
+                return token
+            end
+        })
+    else
+        return nil, "one of [client.token,client.token_file] should be set but 
none"
+    end
+
+    if apiserver.schema == "https" and apiserver.token == "" then
+        return nil, "apiserver.token should set to non-empty string when 
service.schema is https"
+    end
+
+    -- ssl_verify: use explicit config if set, otherwise default to false
+    if conf.service.ssl_verify ~= nil then
+        apiserver.ssl_verify = conf.service.ssl_verify
+    else
+        apiserver.ssl_verify = false
+    end
+
+    return apiserver

Review Comment:
   `informer_factory` can consume `apiserver.ssl_server_name`, but 
`get_apiserver()` never reads an SNI value from `conf.service`. Consider 
copying `conf.service.ssl_server_name` (or similar) into 
`apiserver.ssl_server_name` so the feature is actually usable without manual 
handle mutation.



##########
apisix/discovery/kubernetes/schema.lua:
##########
@@ -129,6 +129,9 @@ return {
                             oneOf = port_patterns,
                             default = "${KUBERNETES_SERVICE_PORT}",
                         },
+                        ssl_verify = {
+                            type = "boolean",
+                        },
                     },

Review Comment:
   `informer_factory.lua` now supports `apiserver.ssl_server_name`, but the 
kubernetes discovery schema doesn't allow configuring it under `service`. If 
this option is intended to be user-configurable, add `ssl_server_name` (string) 
here so config validation permits it.



##########
apisix/discovery/kubernetes/init.lua:
##########
@@ -671,81 +137,36 @@ local function multiple_mode_init(confs)
                     "please check your APISIX version")
         end
 
-        local apiserver, err = get_apiserver(conf)
-        if err then
-            error(err)
-            return
-        end
-
-        local default_weight = conf.default_weight
-
-        local endpoints_informer, err
-        if conf.watch_endpoint_slices then
-            endpoints_informer, err = informer_factory.new("discovery.k8s.io", 
"v1",
-                                                           "EndpointSlice", 
"endpointslices", "")
-        else
-            endpoints_informer, err = informer_factory.new("", "v1", 
"Endpoints", "endpoints", "")
-        end
+        local handle, err = k8s_core.create_handle(conf, {
+            endpoint_dict = endpoint_dict,
+        })
         if err then
             error(err)
             return
         end
 
-        setup_namespace_selector(conf, endpoints_informer)
-        setup_label_selector(conf, endpoints_informer)
-
-        if conf.watch_endpoint_slices then
-            endpoints_informer.on_added = on_endpoint_slices_modified
-            endpoints_informer.on_modified = on_endpoint_slices_modified
-            endpoints_informer.on_deleted = on_endpoint_slices_deleted
-            endpoints_informer.endpoint_slices_cache = {}
-        else
-            endpoints_informer.on_added = on_endpoint_modified
-            endpoints_informer.on_modified = on_endpoint_modified
-            endpoints_informer.on_deleted = on_endpoint_deleted
-        end
-
-        endpoints_informer.pre_list = pre_list
-        endpoints_informer.post_list = post_list
-
-        ctx[id] = setmetatable({
-            endpoint_dict = endpoint_dict,
-            apiserver = apiserver,
-            default_weight = default_weight
-        }, { __index = endpoints_informer })
+        ctx[id] = handle
     end
 
     for _, item in pairs(ctx) do
-        start_fetch(item)
+        k8s_core.start_fetch(item)
     end
 end
 
 
 local function multiple_mode_nodes(service_name)
-    local pattern = "^(.*)/(.*/.*):(.*)$" -- id/namespace/name:port_name
-    local match = ngx.re.match(service_name, pattern, "jo")
-    if not match then
-        core.log.error("get unexpected upstream service_name: ", service_name)
-        return nil
-    end
-
-    local id = match[1]
-    local endpoint_dict = ctx[id]
-    if not endpoint_dict then
-        core.log.error("id not exist")
-        return nil
-    end
-
-    local endpoint_key = match[2]
-    local endpoint_port = match[3]
-    local endpoint_version = endpoint_dict:get(endpoint_key .. "#version")
-    if not endpoint_version then
-        core.log.info("get empty endpoint version from discovery DICT ", 
endpoint_key)
-        return nil
-    end
-
-    return endpoint_lrucache(service_name, endpoint_version,
-            create_endpoint_lrucache, endpoint_dict, endpoint_key, 
endpoint_port)
+    return k8s_core.resolve_nodes(
+        endpoint_lrucache, service_name,
+        "^(.*)/(.*/.*):(.*)$",   -- id/namespace/name:port_name
+        function(match)
+            local id = match[1]
+            local endpoint_dict = ctx[id]
+            if not endpoint_dict then
+                core.log.error("id not exist")
+                return nil
+            end

Review Comment:
   Same issue as single-mode: in the privileged-agent process `ctx[id]` is a 
handle, not an `ngx.shared.DICT`. `k8s_core.resolve_nodes` will call 
`endpoint_dict:get(...)` and error if `nodes()` is invoked there. Adjust the 
resolver to return `ctx[id].endpoint_dict` when available (and keep the current 
behavior for worker processes where `ctx[id]` is already the dict).



##########
apisix/discovery/kubernetes/schema.lua:
##########
@@ -190,6 +193,9 @@ return {
                                 type = "string",
                                 oneOf = port_patterns,
                             },
+                            ssl_verify = {
+                                type = "boolean",
+                            },

Review Comment:
   Multi-config mode has the same gap as single-config mode: 
`service.ssl_server_name` is not present in the schema, so the new SNI support 
in `informer_factory` can't be enabled via config. Add a `ssl_server_name` 
string property here as well (if intended).



##########
apisix/discovery/nacos/client.lua:
##########
@@ -0,0 +1,363 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+--- Reusable HTTP client primitives for Nacos service discovery.
+--- Extracted from init.lua so that both static-config mode and
+--- dynamic-config mode can share the same core logic.
+
+local require         = require
+local http            = require('resty.http')
+local core            = require('apisix.core')
+local ipairs          = ipairs
+local pairs           = pairs
+local type            = type
+local ngx             = ngx
+local ngx_re          = require('ngx.re')
+local string          = string
+local string_sub      = string.sub
+local str_byte        = string.byte
+local str_find        = core.string.find
+local log             = core.log
+
+local auth_path = 'auth/login'
+local instance_list_path = 'ns/instance/list?healthyOnly=true&serviceName='
+local default_namespace_id = "public"
+local default_group_name = "DEFAULT_GROUP"
+
+
+local _M = {}
+
+
+-- ─── HTTP primitives ──────────────────────────────────────────────────
+
+function _M.request(request_uri, path, body, method, basic_auth, timeout)
+    local url = request_uri .. path
+    log.info('request url:', url)

Review Comment:
   `request()` logs the full URL at info level. This URL includes sensitive 
query parameters (eg `accessToken`, `username/password` for login, and HMAC 
signature data) which can leak credentials into logs. Prefer logging at debug 
level and/or redact query strings/sensitive parameters before logging.



##########
apisix/discovery/nacos/client.lua:
##########
@@ -0,0 +1,363 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+--- Reusable HTTP client primitives for Nacos service discovery.
+--- Extracted from init.lua so that both static-config mode and
+--- dynamic-config mode can share the same core logic.
+
+local require         = require
+local http            = require('resty.http')
+local core            = require('apisix.core')
+local ipairs          = ipairs
+local pairs           = pairs
+local type            = type
+local ngx             = ngx
+local ngx_re          = require('ngx.re')
+local string          = string
+local string_sub      = string.sub
+local str_byte        = string.byte
+local str_find        = core.string.find
+local log             = core.log
+
+local auth_path = 'auth/login'
+local instance_list_path = 'ns/instance/list?healthyOnly=true&serviceName='
+local default_namespace_id = "public"
+local default_group_name = "DEFAULT_GROUP"
+
+
+local _M = {}
+
+
+-- ─── HTTP primitives ──────────────────────────────────────────────────
+
+function _M.request(request_uri, path, body, method, basic_auth, timeout)
+    local url = request_uri .. path
+    log.info('request url:', url)
+    local headers = {}
+    headers['Accept'] = 'application/json'
+
+    if basic_auth then
+        headers['Authorization'] = basic_auth
+    end
+
+    if body and 'table' == type(body) then
+        local err
+        body, err = core.json.encode(body)
+        if not body then
+            return nil, 'invalid body : ' .. err
+        end
+        headers['Content-Type'] = 'application/json'
+    end
+
+    local httpc = http.new()
+    timeout = timeout or {}
+    local connect_timeout = timeout.connect or 2000
+    local send_timeout = timeout.send or 5000
+    local read_timeout = timeout.read or 5000
+    httpc:set_timeouts(connect_timeout, send_timeout, read_timeout)
+    local res, err = httpc:request_uri(url, {
+        method = method,
+        headers = headers,
+        body = body,
+        ssl_verify = true,
+    })
+    if not res then
+        return nil, err
+    end
+
+    if not res.body or res.status ~= 200 then
+        return nil, 'status = ' .. res.status
+    end
+
+    local json_str = res.body
+    local data, decode_err = core.json.decode(json_str)
+    if not data then
+        return nil, decode_err
+    end
+    return data
+end
+
+
+-- ─── authentication ───────────────────────────────────────────────────
+
+function _M.get_token_param(base_uri, username, password, timeout)
+    if not username or not password then
+        return ''
+    end
+
+    local args = { username = username, password = password }
+    local data, err = _M.request(base_uri, auth_path .. '?' .. 
ngx.encode_args(args),
+                                 nil, 'POST', nil, timeout)
+    if err then
+        log.error('nacos login fail:', username, ' ', password, ' desc:', err)

Review Comment:
   On login failure this log line includes the raw Nacos password. Avoid 
logging credentials (even at error level); log only the username (or better, 
just the host) and the error.



##########
apisix/discovery/nacos/client.lua:
##########
@@ -0,0 +1,363 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+--- Reusable HTTP client primitives for Nacos service discovery.
+--- Extracted from init.lua so that both static-config mode and
+--- dynamic-config mode can share the same core logic.
+
+local require         = require
+local http            = require('resty.http')
+local core            = require('apisix.core')
+local ipairs          = ipairs
+local pairs           = pairs
+local type            = type
+local ngx             = ngx
+local ngx_re          = require('ngx.re')
+local string          = string
+local string_sub      = string.sub
+local str_byte        = string.byte
+local str_find        = core.string.find
+local log             = core.log
+
+local auth_path = 'auth/login'
+local instance_list_path = 'ns/instance/list?healthyOnly=true&serviceName='
+local default_namespace_id = "public"
+local default_group_name = "DEFAULT_GROUP"
+
+
+local _M = {}
+
+
+-- ─── HTTP primitives ──────────────────────────────────────────────────
+
+function _M.request(request_uri, path, body, method, basic_auth, timeout)
+    local url = request_uri .. path
+    log.info('request url:', url)
+    local headers = {}
+    headers['Accept'] = 'application/json'
+
+    if basic_auth then
+        headers['Authorization'] = basic_auth
+    end
+
+    if body and 'table' == type(body) then
+        local err
+        body, err = core.json.encode(body)
+        if not body then
+            return nil, 'invalid body : ' .. err
+        end
+        headers['Content-Type'] = 'application/json'
+    end
+
+    local httpc = http.new()
+    timeout = timeout or {}
+    local connect_timeout = timeout.connect or 2000
+    local send_timeout = timeout.send or 5000
+    local read_timeout = timeout.read or 5000
+    httpc:set_timeouts(connect_timeout, send_timeout, read_timeout)
+    local res, err = httpc:request_uri(url, {
+        method = method,
+        headers = headers,
+        body = body,
+        ssl_verify = true,
+    })
+    if not res then
+        return nil, err
+    end
+
+    if not res.body or res.status ~= 200 then
+        return nil, 'status = ' .. res.status
+    end
+
+    local json_str = res.body
+    local data, decode_err = core.json.decode(json_str)
+    if not data then
+        return nil, decode_err
+    end
+    return data
+end
+
+
+-- ─── authentication ───────────────────────────────────────────────────
+
+function _M.get_token_param(base_uri, username, password, timeout)
+    if not username or not password then
+        return ''
+    end
+
+    local args = { username = username, password = password }
+    local data, err = _M.request(base_uri, auth_path .. '?' .. 
ngx.encode_args(args),
+                                 nil, 'POST', nil, timeout)
+    if err then
+        log.error('nacos login fail:', username, ' ', password, ' desc:', err)
+        return nil, err
+    end
+    return '&accessToken=' .. data.accessToken
+end
+
+
+function _M.get_signed_param(group_name, service_name, access_key, secret_key)
+    local param = ''
+    if access_key and access_key ~= '' and secret_key and secret_key ~= '' then
+        local str_to_sign = ngx.now() * 1000 .. '@@' .. group_name .. '@@' .. 
service_name
+        local args = {
+            ak = access_key,
+            data = str_to_sign,
+            signature = ngx.encode_base64(ngx.hmac_sha1(secret_key, 
str_to_sign))
+        }
+        param = '&' .. ngx.encode_args(args)
+    end
+    return param
+end
+
+
+-- ─── URL building ─────────────────────────────────────────────────────
+
+function _M.build_base_uri(url, prefix)
+    local auth_idx = core.string.rfind_char(url, '@')
+    local username, password
+    if auth_idx then
+        local protocol_idx = str_find(url, '://')
+        local protocol = string_sub(url, 1, protocol_idx + 2)
+        local user_and_password = string_sub(url, protocol_idx + 3, auth_idx - 
1)
+        local arr = ngx_re.split(user_and_password, ':')
+        if #arr == 2 then
+            username = arr[1]
+            password = arr[2]
+        end
+        local other = string_sub(url, auth_idx + 1)
+        url = protocol .. other
+    end
+
+    if prefix then
+        url = url .. prefix
+    end
+
+    if str_byte(url, #url) ~= str_byte('/') then
+        url = url .. '/'
+    end
+
+    return url, username, password
+end
+
+
+-- ─── query param helpers ──────────────────────────────────────────────
+
+local function get_namespace_param(namespace_id)
+    local param = ''
+    if namespace_id then
+        local args = { namespaceId = namespace_id }
+        param = '&' .. ngx.encode_args(args)
+    end
+    return param
+end
+
+
+local function get_group_name_param(group_name)
+    local param = ''
+    if group_name then
+        local args = { groupName = group_name }
+        param = '&' .. ngx.encode_args(args)
+    end
+    return param
+end
+
+
+local function is_grpc(scheme)
+    return scheme == 'grpc' or scheme == 'grpcs'
+end
+
+
+-- ─── instance fetching ────────────────────────────────────────────────
+
+--- Fetch instances from a single nacos host for a list of services.
+---
+--- Returns: service_nodes (table of key → nodes), service_names (set), ok 
(bool)
+---
+--- options:
+---   default_weight     (number)    default node weight
+---   access_key         (string)    AK for HMAC-SHA1 signing (optional)
+---   secret_key         (string)    SK for HMAC-SHA1 signing (optional)
+---   timeout            (table)     { connect, send, read } in ms
+---   preserve_metadata  (bool)      include instance.metadata in returned 
nodes
+---   key_builder        (function)  key_builder(namespace_id, group_name, 
service_name)
+---                                  returns the key to use for this service 
in the result.
+---                                  default: namespace_id .. '.' .. 
group_name .. '.' .. service_name
+
+function _M.fetch_from_host(base_uri, username, password, services, options)

Review Comment:
   The docstring says `fetch_from_host` returns "service_nodes, service_names, 
ok (bool)", but the implementation returns `(nodes_cache, service_names)` on 
success and `(nil, nil, err)` on failure. Update the docstring to match the 
actual return values to avoid misleading external consumers.



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