membphis commented on a change in pull request #4880:
URL: https://github.com/apache/apisix/pull/4880#discussion_r801646329
##########
File path: apisix/discovery/kubernetes/init.lua
##########
@@ -29,7 +29,10 @@ local core = require("apisix.core")
local util = require("apisix.cli.util")
local local_conf = require("apisix.core.config_local").local_conf()
local informer_factory =
require("apisix.discovery.kubernetes.informer_factory")
-local endpoint_dict = ngx.shared.discovery
+local endpoint_dict = ngx.shared["discovery"]
+if not endpoint_dict then
+ error("failed to get ngx.shared.dict discovery when load kubernetes
discovery plugin ")
Review comment:
not clear
##########
File path: apisix/discovery/kubernetes/informer_factory.lua
##########
@@ -152,48 +152,47 @@ local function split_event (body, dispatch_event)
remainder_body = string.sub(body, captured_size + 1)
end
- return remainder_body, "Success", nil
+ return remainder_body, "Success"
Review comment:
I think "Success" is meaningless. let us remove it
##########
File path: apisix/discovery/kubernetes/informer_factory.lua
##########
@@ -240,24 +239,24 @@ local function watch(httpc, apiserver, informer)
body = remainder_body .. body
end
- remainder_body, reason, err = split_event(body, dispatch_event)
+ remainder_body, reason, err = split_event(body, dispatch_event,
informer)
if reason ~= "Success" then
if reason == "ResourceGone" then
- return true, "Success", nil
+ return true
end
return false, reason, err
end
end
end
- return true, "Success", nil
+ return true
end
-local function list_watch(self, apiserver)
+local function list_watch(informer, apiserver)
Review comment:
nice change
--
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]