Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: consul discovery can not fetch a svc`s all endpoint #8827

Closed
dyrnq opened this issue Feb 10, 2023 · 5 comments
Closed

bug: consul discovery can not fetch a svc`s all endpoint #8827

dyrnq opened this issue Feb 10, 2023 · 5 comments

Comments

@dyrnq
Copy link
Contributor

dyrnq commented Feb 10, 2023

Current Behavior

curl -fsL http://127.0.0.1:9090/v1/discovery/consul/dump | jq
{
  "config": {
    "weight": 1,
    "fetch_interval": 3,
    "servers": [
      "http://127.0.0.1:8500"
    ],
    "timeout": {
      "wait": 60,
      "read": 2000,
      "connect": 2000
    },
    "keepalive": true
  },
  "services": {
    "netshoot-2-netshoot-group": [
      {
        "weight": 1,
        "port": 8080,
        "host": "10.5.42.20"
      }
    ],
    "nomad": [
      {
        "weight": 1,
        "port": 4648,
        "host": "192.168.33.4"
      },
      {
        "weight": 1,
        "port": 4646,
        "host": "192.168.33.4"
      },
      {
        "weight": 1,
        "port": 4647,
        "host": "192.168.33.4"
      }
    ],
    "nomad-client": [
      {
        "weight": 1,
        "port": 4646,
        "host": "192.168.33.4"
      }
    ]
  }
}
curl -fsSL http://127.0.0.1:8500/v1/catalog/service/netshoot-2-netshoot-group |jq -r ".[].ServiceAddress"
10.5.42.20
10.5.53.28
10.5.53.26
10.5.53.27
10.5.37.30
10.5.93.25
10.5.93.23
10.5.93.2
10.5.93.24
10.5.93.22

Expected Behavior

get the svc`s all endpotins through this consul agent from the whole consul cluster.

Error Logs

No response

Steps to Reproduce

1、run apisix 3.1.0
2、config disconvery

discovery:                       # service discovery center
  dns:
    servers:
      - "127.0.0.1:8600"         # use the real address of your dns server
  consul:
    servers:
      - "http://127.0.0.1:8500"

3、put route

curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
  "uri": "/",
  "name": "consul-netshoot-2-netshoot-group",
  "upstream": {
    "timeout": {
      "connect": 6,
      "send": 6,
      "read": 6
    },
    "type": "roundrobin",
    "scheme": "http",
    "discovery_type": "consul",
    "pass_host": "pass",
    "service_name": "netshoot-2-netshoot-group",
    "keepalive_pool": {
      "idle_timeout": 60,
      "requests": 1000,
      "size": 320
    }
  }
}'

Environment

  • APISIX version (run apisix version): docker.io/apache/apisix:3.1.0-debian
  • Operating system (run uname -a): Linux vm4 5.4.0-132-generic #148-Ubuntu SMP Mon Oct 17 16:02:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): {"id":"ecd7565b-73f0-4c62-8cf2-20d42eb2766d","hostname":"9e6fc857823c","boot_time":1676009281,"etcd_version":"3.5.0","version":"3.1.0"}
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):
@dyrnq dyrnq changed the title bug: consul discovery can not fetch all svc bug: consul discovery can not fetch a svc`s all endpoint Feb 10, 2023
@Fabriceli
Copy link
Contributor

had fixed it, referenced #8651

@dyrnq
Copy link
Contributor Author

dyrnq commented Feb 14, 2023

had fixed it, referenced #8651

Great work!! Very good.

By the way, does apisix consul discovery support directly get a svc`s all health endpoints through Consul Health API consul/api-docs/health?

So if get endpoints from Consul Health API apisix will not be required to health check the endpoints,
then if get endpoints from Consul Catalog API , apisix have to health check the endpoints.

@dyrnq
Copy link
Contributor Author

dyrnq commented Feb 14, 2023

@Fabriceli

And the Consul Health API like this blow, there are some different places between Health API and Catalog API, parameter and response body

  • Consul Health API, var query passing=true get health endpoints only
curl -fsSL http://127.0.0.1:8500/v1/health/service/netshoot-2-netshoot-group?passing=true
  • Consul Catalog API
curl -fsSL http://127.0.0.1:8500/v1/catalog/service/netshoot-2-netshoot-group

@Fabriceli
Copy link
Contributor

had fixed it, referenced #8651

Great work!! Very good.

By the way, does apisix consul discovery support directly get a svc`s all health endpoints through Consul Health API consul/api-docs/health?

So if get endpoints from Consul Health API apisix will not be required to health check the endpoints, then if get endpoints from Consul Catalog API , apisix have to health check the endpoints.

Not support yet. Please make apisix to health check the endpoints

@dyrnq
Copy link
Contributor Author

dyrnq commented Feb 14, 2023

got it , tanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants