chore: remove useless watch#173
Conversation
Signed-off-by: ashing <axingfly@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR removes unused event watches and related helper methods for IngressClass and GatewayProxy from both ApisixUpstream and ApisixPluginConfig controllers, and simplifies their Reconcile methods to only update status.
- Drop IngressClass/GatewayProxy watches and mapping functions
- Simplify Reconcile to only set status and return success
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/controller/apisixupstream_controller.go | Removed watches and helper methods for IngressClass/GatewayProxy; simplified Reconcile |
| internal/controller/apisixpluginconfig_controller.go | Same removals and simplification for ApisixPluginConfig controller |
Comments suppressed due to low confidence (2)
internal/controller/apisixupstream_controller.go:41
- [nitpick] Event watches for IngressClass and GatewayProxy have been removed but related unit/integration tests may still expect them. Please update or remove tests to reflect these changes.
WithEventFilter(predicate.GenerationChangedPredicate{}).
internal/controller/apisixpluginconfig_controller.go:42
- [nitpick] Tests covering the removed IngressClass and GatewayProxy watches should be updated to avoid false failures. Consider removing or adjusting those test cases.
WithEventFilter(predicate.GenerationChangedPredicate{}).
| var err error | ||
| defer func() { | ||
| r.updateStatus(&au, err) |
There was a problem hiding this comment.
The declared error variable 'err' is never set before reconciliation returns; updateStatus will always see err as nil, masking potential failures. Remove the unused variable or reintroduce appropriate error handling.
| var err error | |
| defer func() { | |
| r.updateStatus(&au, err) | |
| defer func() { | |
| r.updateStatus(&au, nil) |
| ic *networkingv1.IngressClass | ||
| err error | ||
| ) | ||
| var err error |
There was a problem hiding this comment.
The declared error variable 'err' is never used before Reconcile returns; updateStatus will always treat the operation as successful. Either remove this declaration or wire up actual error propagation.
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-06-23T02:53:19Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: APISIX
project: apisix-ingress-controller
url: https://github.com/apache/apisix-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
result: partial
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 0
Passed: 32
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests partially succeeded with 1 test skips. |
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-06-23T02:36:00Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: APISIX
project: apisix-ingress-controller
url: https://github.com/apache/apisix-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
failedTests:
- HTTPRouteInvalidBackendRefUnknownKind
result: failure
skippedTests:
- HTTPRouteHTTPSListener
statistics:
Failed: 1
Passed: 31
Skipped: 1
name: GATEWAY-HTTP
summary: Core tests failed with 1 test failures. |
| var err error | ||
| defer func() { | ||
| r.updateStatus(&pc, err) | ||
| }() | ||
|
|
||
| if ic, err = r.getIngressClass(&pc); err != nil { | ||
| return ctrl.Result{}, err | ||
| } | ||
| if err = r.processIngressClassParameters(ctx, &pc, ic); err != nil { | ||
| return ctrl.Result{}, err | ||
| } | ||
| // Only update status | ||
| return ctrl.Result{}, nil | ||
| } |
There was a problem hiding this comment.
不用 defer update 了,而且也不会有 err != nil 的情况了
Signed-off-by: ashing <axingfly@gmail.com>
Type of change:
What this PR does / why we need it:
Pre-submission checklist: