lingsamuel commented on code in PR #10298:
URL: https://github.com/apache/apisix/pull/10298#discussion_r1349606036
##########
apisix/http/service.lua:
##########
@@ -61,7 +61,7 @@ function _M.init_worker()
filter = filter,
})
if not services then
- error("failed to create etcd instance for fetching upstream: " .. err)
+ error("failed to create etcd instance for fetching /services: " .. err)
Review Comment:
other resources have similar format. it indicates the etcd key
##########
apisix/init.lua:
##########
@@ -1078,6 +1079,34 @@ function _M.stream_preread_phase()
api_ctx.matched_upstream = upstream
+ elseif matched_route.value.service_id then
+ local service = service_fetch(matched_route.value.service_id)
+ if not service then
+ core.log.error("failed to fetch service configuration by ",
+ "id: ", matched_route.value.service_id)
+ return core.response.exit(404)
+ end
+
+ matched_route = plugin.merge_service_stream_route(service,
matched_route)
+ api_ctx.matched_route = matched_route
+ api_ctx.conf_type = "stream_route&service"
+ api_ctx.conf_version = matched_route.modifiedIndex .. "&" ..
service.modifiedIndex
+ api_ctx.conf_id = matched_route.value.id .. "&" .. service.value.id
+ api_ctx.service_id = service.value.id
+ api_ctx.service_name = service.value.name
+ api_ctx.matched_upstream = matched_route.value.upstream
+ if matched_route.value.upstream_id and not
matched_route.value.upstream then
+ local upstream =
apisix_upstream.get_by_id(matched_route.value.upstream_id)
+ if not upstream then
+ if is_http then
+ return core.response.exit(502)
+ end
+
+ return ngx_exit(1)
Review Comment:
because no upstream available here
--
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]