AlinsRan commented on code in PR #13991:
URL: https://github.com/apache/apisix/pull/13991#discussion_r4131674364


##########
apisix/discovery/kubernetes/init.lua:
##########
@@ -154,7 +161,86 @@ local function multiple_mode_init(confs)
 end
 
 
-local function multiple_mode_nodes(service_name)
+local function merge_cluster_nodes(endpoint_dicts, endpoint_key, endpoint_port)
+    local nodes = {}
+    local seen = {}
+    for _, endpoint_dict in ipairs(endpoint_dicts) do
+        local cluster_nodes = k8s_core.create_endpoint_lrucache(endpoint_dict, 
endpoint_key,
+                                                                endpoint_port)
+        for _, node in ipairs(cluster_nodes or {}) do
+            local addr = node.host .. ":" .. tostring(node.port)
+            if not seen[addr] then
+                seen[addr] = true
+                core.table.insert(nodes, node)
+            end
+        end
+    end
+
+    return nodes
+end
+
+
+-- with cluster_ids, service_name is "namespace/name:port_name"
+local cluster_ids_service_name_pattern = [[^([^/]+/[^/:]+):(.+)$]]

Review Comment:
   Fixed in b2d7ddbc87a02afebf8cf69c5149b16a7cf36385. The shared `cluster_ids` 
pattern is now `^([^/:]+/[^/:]+):([^/:]+)$`, so `:` and `/` are rejected in the 
namespace, name and port name segments. `ns:extra/svc:p1` and `ns/svc:p1:extra` 
were added as test cases.



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