You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "GitNimay (via GitHub)" <gi...@apache.org> on 2026/10/19 17:18:50 UTC
[PR] fix(kubernetes): fail the list when a later page fails [apisix]
GitNimay opened a new pull request, #14053:
URL: https://github.com/apache/apisix/pull/14053
### Description
Kubernetes discovery lists Endpoints in pages of 120. `list()` in `apisix/discovery/kubernetes/informer_factory.lua` fetches each following page with a recursive call but ignores its result:
```lua
informer.continue = data.metadata.continue
if informer.continue and informer.continue ~= "" then
...
list(httpc, apiserver, informer)
end
return true
```
If a later page fails (for example while the API server is returning etcd errors during a control-plane restart), `list()` still returns `true`. `list_watch()` then runs `post_list()`, which deletes every endpoint in the shared dict that the list did not touch, which includes everything on the pages that never loaded. The following watch only delivers deltas, so those services stay without endpoints (`no valid upstream node`) until APISIX restarts. No `list failed` error is logged, which matches the report.
This PR returns the result of the recursive call. A failed later page now fails the whole list: `list_watch()` logs `list failed`, skips `post_list()`, and the informer retries with a full re-list. As a side effect, the recursion is now a proper tail call.
#### Which issue(s) this PR fixes:
Fixes #14050
### Tests
Added `t/discovery/kubernetes_list_pagination.t`, which mocks `resty.http` (same approach as `kubernetes_ssl_verify.t`) with an API server that serves the Endpoints list in two pages:
- TEST 1: both pages succeed, so both are added and `post_list()` runs.
- TEST 2: the second page returns 500, so the list fails with `list failed` and `post_list()` is not called.
Without the fix, TEST 2 fails (`post_list called`, `fetch_state: watch failed`). With the fix, `kubernetes_list_pagination.t`, `kubernetes_ssl_verify.t`, `kubernetes_cluster_ids.t` and `kubernetes_schema.t` pass locally. `luacheck` and `lj-releng` are clean.
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [ ] I have updated the documentation to reflect this change (not needed, no user-facing change)
- [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(kubernetes): fail the list when a later page fails [apisix]
Posted by "GitNimay (via GitHub)" <gi...@apache.org>.
GitNimay commented on PR #14053:
URL: https://github.com/apache/apisix/pull/14053#issuecomment-6296278824
Thanks @nic-6443 and @AlinsRan for the reviews and approvals!
@membphis @shreemaan-abhishek could you take a look when you have a moment? This needs one more approval to merge. CI is green, and the change is a one-line fix in the Kubernetes informer's paginated list (plus a regression test), so it should be a quick review.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(kubernetes): fail the list when a later page fails [apisix]
Posted by "guoqqqi (via GitHub)" <gi...@apache.org>.
guoqqqi merged PR #14053:
URL: https://github.com/apache/apisix/pull/14053
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org