bzp2010 commented on code in PR #2856:
URL:
https://github.com/apache/apisix-ingress-controller/pull/2856#discussion_r3988659399
##########
internal/provider/apisix/status.go:
##########
@@ -42,32 +55,101 @@ import (
func (d *apisixProvider) handleStatusUpdate(statusUpdateMap
map[types.NamespacedNameKind][]string) {
// Mark all resources in the current failure set as failed.
for nnk, msgs := range statusUpdateMap {
- d.updateStatus(nnk, cutils.NewConditionTypeAccepted(
- apiv2.ConditionReasonSyncFailed,
- false,
- 0,
- strings.Join(msgs, "; "),
- ))
+ d.updateStatus(nnk, failureCondition(nnk, strings.Join(msgs, ";
")))
}
// Mark resources that exist only in the previous failure history as
successful.
for nnk := range d.statusUpdateMap {
if _, ok := statusUpdateMap[nnk]; !ok {
- d.updateStatus(nnk, cutils.NewConditionTypeAccepted(
- apiv2.ConditionReasonAccepted,
- true,
- 0,
- "",
- ))
+ d.updateStatus(nnk, successCondition(nnk))
Review Comment:
Reworked the whole status pipeline: GatewayProxy's DataPlaneAvailable is now
recomputed from scratch every sync round straight from that round's actual
result, never diffed against remembered history. A round with no error writes
True, any error writes False — recovery is never inferred from a key merely
leaving a failure set. This makes the class of bug you describe structurally
impossible rather than patching the specific case. See
`updateStatusFromSyncResults`/`classifySyncResult` in
`internal/provider/apisix/status.go`.
Cost note, since this write path is now unconditional every round instead of
only on change: the enqueue itself is cheap (a channel send), and the actual
write is still deduped by the pre-existing `statusEqual` check in
`UpdateHandler.updateStatus` (`internal/controller/status/updater.go`), so an
unchanged GatewayProxy never triggers a real PATCH. The `client.Get` that check
needs reads through the manager's shared informer cache, not the API server —
GatewayProxy already has its own controller/watch (`GatewayProxyController`),
so this isn't a fresh network round trip. The added cost is bounded to the
(typically small) number of GatewayProxies; the per-resource path (ApisixRoute
etc.) is untouched and keeps the old change-only write behavior.
--
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]