Hi, community,

I wanted to talk to you about the optimization of the Consul discovery.

WHAT

Currently, the Consul discovery plugin can dump all services info in APISIX, 
Specific usage reference:

https://github.com/apache/apisix/blob/master/docs/en/latest/discovery/consul.md

In Consul discovery Lua code, the Consul discovery plugin used 
/catalog/services to check update and /agent/services to get all services info. 
for some situation, it can not get all services info from this /agent/services, 
reference reading: https://developer.hashicorp.com/consul/api-docs/agent/service

The /agent/service endpoints interact with services on the local agent in 
Consul. These should not be confused with services in the catalog.

WHY

  1.  Optimize Consul discovery plugin to make the APISIX more robust

  2.  Obtain the services info form Consul to be more precise

HOW

  1.  Obtain all services with /catalog/services, reference: Consul List 
Services<https://developer.hashicorp.com/consul/api-docs/catalog#list-services>

  2.  Obtain nodes for each service with /catalog/service/:service, reference: 
Consul List Nodes for 
Service<https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes-for-service>

  3.  Save this service node info in local variable

Best Regard

Yihao LI

My GitHub: https://github.com/Fabriceli

Reply via email to