Skip to content

Conversation

@ronething
Copy link
Contributor

@ronething ronething commented Jun 20, 2025

Type of change:

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches
  • Documentation
  • Refactor
  • Chore
  • CI/CD or Tests

What this PR does / why we need it:

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@ronething ronething requested a review from Copilot June 20, 2025 07:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{}).

Comment on lines 52 to 54
var err error
defer func() {
r.updateStatus(&au, err)
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
var err error
defer func() {
r.updateStatus(&au, err)
defer func() {
r.updateStatus(&au, nil)

Copilot uses AI. Check for mistakes.
ic *networkingv1.IngressClass
err error
)
var err error
Copy link

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2025

conformance test report

apiVersion: 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2025

conformance test report

apiVersion: 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.

Comment on lines 53 to 60
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
}
Copy link
Contributor

@dspo dspo Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用 defer update 了,而且也不会有 err != nil 的情况了

Signed-off-by: ashing <[email protected]>
@ronething ronething merged commit 3226d01 into release-v2-dev Jun 23, 2025
12 of 13 checks passed
@ronething ronething deleted the refactor/remove_watch branch June 23, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants