You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Lcos-000 (via GitHub)" <gi...@apache.org> on 2026/09/12 04:51:06 UTC
[PR] fix: clean up APISIX resources when GatewayProxy becomes inactive [apisix-ingress-controller]
Lcos-000 opened a new pull request, #2871:
URL: https://github.com/apache/apisix-ingress-controller/pull/2871
### Type of change
- [x] Bugfix
- [x] CI/CD or Tests
### What this PR does / why we need it
This PR fixes stale data-plane resources left behind when a `GatewayProxy` is deleted, becomes invalid, or no longer has any referrers.
Previously, these paths could remove only the local ConfigManager entry or return without notifying the Provider. As a result, resources previously synchronized through the GatewayProxy could remain in the ADC Store and APISIX.
This change:
- Triggers GatewayProxy cleanup when the GatewayProxy is deleted, its provider is cleared or invalid, or it has no remaining referrers;
- Removes all resources owned by the GatewayProxy from the local ADC Store;
- Sends an empty resource configuration to ADC using the previous GatewayProxy connection details;
- Removes the ConfigManager entry only after the ADC synchronization succeeds;
- Preserves the configuration when synchronization fails so cleanup can be retried;
- Removes stale resource-to-configuration associations and PluginMetadata;
- Uses a stable canonical key for GatewayProxy configurations, independent of `TypeMeta`;
- Skips inactive GatewayProxy configurations during configuration building.
Fixes #2870
### Tests
Added coverage for GatewayProxy deletion and invalidation, cleanup without referrers, cleanup isolation, retry and idempotent behavior, deletion without `TypeMeta`, PluginMetadata cleanup, and inactive GatewayProxy translation.
Validation performed:
```text
go test -count=1 ./api/... ./internal/...
go test -race -count=1 ./internal/provider/apisix ./internal/adc/translator ./internal/controller ./internal/adc/client
go vet ./internal/provider/apisix ./internal/adc/translator ./internal/controller ./internal/adc/client
go test -count=1 ./test/e2e/gatewayapi -run ^
git diff --check
```
### Pre-submission checklist
- [x] The problem and motivation are explained.
- [x] Corresponding test cases have been added.
- [x] The change is backward compatible.
- [ ] Documentation changes are required.
--
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: clean up APISIX resources when GatewayProxy becomes inactive [apisix-ingress-controller]
Posted by "AlinsRan (via GitHub)" <gi...@apache.org>.
AlinsRan commented on PR #2871:
URL: https://github.com/apache/apisix-ingress-controller/pull/2871#issuecomment-6091683422
@Lcos-000 Two things need to be addressed:
**1. Please resolve the conflicts with master.**
**2. The `Store.Delete` change reintroduces the bug fixed in #2885**
```go
if len(resourceTypes) == 0 {
delete(s.cacheMap, name)
...
return nil
}
```
Deleting an ApisixGlobalRule calls `Store.Delete` with empty `resourceTypes`. With this branch, deleting a single ApisixGlobalRule wipes every resource under the whole GatewayProxy. #2885 removed this special case to fix exactly that; wiping the whole config is now done by `DeleteAll`.
Please drop this branch and use `DeleteAll` when a GatewayProxy is deleted.
--
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