hanqingwu commented on code in PR #11111:
URL: https://github.com/apache/apisix/pull/11111#discussion_r1566595073
##########
apisix/discovery/kubernetes/init.lua:
##########
@@ -615,4 +615,46 @@ function _M.init_worker()
end
end
+
+function _M.dump_data()
+
+ local eps = {}
+ for _, conf in ipairs(local_conf.discovery.kubernetes) do
+
+ local id = conf.id
+ local endpoint_dict = get_endpoint_dict(id)
+ local keys, err = endpoint_dict:get_keys()
+ if err then
+ error(err)
+ break
+ end
+
+ if keys then
+ local k8s = {}
+ for i = 1, #keys do
+
+ local key = keys[i]
+ --skip key with suffix #version
+ if key:sub(-#"#version") ~= "#version" then
Review Comment:
I think string.sub more performant: It typically performs well due to its
simplicity involving basic index calculation and memory copying.
--
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]