Skip to content

Conversation

@AlinsRan
Copy link
Contributor

@AlinsRan AlinsRan commented May 22, 2025

To avoid state updates blocking the normal synchronization of resources in scenarios where a large amount of resources are synchronized.

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

@github-actions
Copy link
Contributor

github-actions bot commented May 22, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-05-23T06:44:48Z"
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.

@AlinsRan AlinsRan marked this pull request as ready for review May 23, 2025 00:59
@AlinsRan AlinsRan requested a review from Copilot May 23, 2025 02:41
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 refactors status updates to be asynchronous by introducing a dedicated status handler and replacing direct Status().Update calls with non‐blocking enqueues.

  • Added a new status package with UpdateHandler, Updater interface, and UpdateWriter for async status updates.
  • Updated manager setup to register the UpdateHandler and pass its writer to controllers.
  • Refactored controllers to gather status.Update entries in TranslateContext and enqueue them via Updater.Update.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/provider/provider.go Switched TranslateContext.StatusUpdaters from []client.Object to []status.Update.
internal/manager/run.go Registered NewStatusUpdateHandler with the manager and added its writer.
internal/manager/controllers.go Extended setupControllers to accept status.Updater and wired it to most reconcilers.
internal/controller/status/updater.go Introduced async UpdateHandler, Updater interface, and UpdateWriter.
internal/controller/utils.go Added NamespacedName helper for status updates.
internal/controller/*.go Replaced sync Status().Update calls with enqueues to Updater.Update.
Comments suppressed due to low confidence (2)

internal/manager/controllers.go:101

  • The IngressClassReconciler is instantiated without the Updater field, which prevents async status updates for IngressClass. Add Updater: updater, to this struct literal.
Provider: pro,

internal/controller/status/updater.go:1

  • [nitpick] No unit tests were added for the new UpdateHandler; consider adding tests for its Start, apply, and Writer behaviors.
// Licensed under the Apache License, Version 2.0 (the "License");

}
if updated {
tctx.StatusUpdaters = append(tctx.StatusUpdaters, policy.DeepCopy())
tctx.StatusUpdaters = append(tctx.StatusUpdaters, status.Update{
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

[nitpick] The repeated status.Update closures across controllers introduce duplication; consider extracting a helper function to build these updates.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ronething ronething left a comment

Choose a reason for hiding this comment

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

lgtm

@AlinsRan AlinsRan merged commit 4ee0e26 into release-v2-dev May 23, 2025
9 checks passed
@AlinsRan AlinsRan deleted the refactor/async-update-status branch May 23, 2025 09:39
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