api7 / apisix-mesh-agent

Apache License 2.0
78 stars 10 forks source link

bug: empty nodes shouldn't be pushed #76

Open lingsamuel opened 3 years ago

lingsamuel commented 3 years ago

What was observed:

  1. Upstream nodes was [] at first (ErrRequireFurtherEDS)
  2. nodes field is filled because EDS discovery request relaunched.
  3. nodes field becomes to null, which shouldn't happen (expect [])
  4. field filled again

Potential reason/solution:

  1. We shouldn't diff/push upstreams without nodes.
2021-07-30T09:07:42Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:9 > watch_id:8904024913264939081 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:9 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[]}\" > > "}
2021-07-30T09:07:42Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:9 > watch_id:8346669795801368927 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:9 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[]}\" > > "}
2021-07-30T09:07:42Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:52 > watch_id:8232413655645001304 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:52 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:07:42Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:61 > watch_id:8232413655645001304 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:61 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:07:43Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:76 > watch_id:5734981627565263076 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:76 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:07:59Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:89 > watch_id:7974534800063987285 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:89 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:07:59Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:89 > watch_id:1813490297230483095 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:89 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:08:02Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:90 > watch_id:2570760367334079084 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:90 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":null}\" > > "}
2021-07-30T09:08:02Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:90 > watch_id:6194359304354840107 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:90 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":null}\" > > "}
2021-07-30T09:08:26Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:91 > watch_id:8278034643074459971 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:91 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:08:26Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:91 > watch_id:509128235888185990 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:91 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:08:29Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:92 > watch_id:325048705736504245 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:92 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":null}\" > > "}
2021-07-30T09:08:29Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:92 > watch_id:1925719665951869875 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:92 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":null}\" > > "}
2021-07-30T09:09:24Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:93 > watch_id:6477593125839127539 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:93 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
2021-07-30T09:09:24Z    debug   etcdv3  etcdv3/watch.go:250 sent WatchResponse  {"watch_response": "header:<revision:93 > watch_id:3133531804644248654 events:<kv:<key:\"/apisix/upstreams/a154bb95\" create_revision:9 mod_revision:93 value:\"{\\\"timeout\\\":{\\\"connect\\\":10,\\\"send\\\":60,\\\"read\\\":60},\\\"type\\\":\\\"roundrobin\\\",\\\"name\\\":\\\"outbound|80||httpbin.apisix-mesh-agent-e2e-681030838.svc.cluster.local\\\",\\\"id\\\":\\\"a154bb95\\\",\\\"nodes\\\":[{\\\"host\\\":\\\"172.17.0.6\\\",\\\"port\\\":80,\\\"weight\\\":1}]}\" > > "}
tokers commented 3 years ago

Some places might be wrong to handle the empty node, [] is allowed in APISIX while null is forbidden, we should fix the latter.