Skip to content

refactor: SetRouteConditionResolvedRefs function #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release-v2-dev
Choose a base branch
from

Conversation

ronething
Copy link
Contributor

@ronething ronething commented May 16, 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 May 16, 2025 09:22
Copy link
Contributor

@Copilot 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 how the resolved references condition is set for routes by replacing separate status and message parameters with an error object and by introducing a dedicated error type for backend not found situations.

  • Updates the SetRouteConditionResolvedRefs function in utils.go to accept an error instead of a boolean status and message.
  • Modifies httproute_controller.go to use error objects for backend reference resolution and to correctly prioritize invalid kind errors.
  • Adds a new BackendNotFoundError type with helper functions for error handling.

Reviewed Changes

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

File Description
internal/controller/utils.go Refactors the condition-setting function and adds a new error type for backend not found.
internal/controller/httproute_controller.go Adjusts error handling logic for backend refs and updates status reporting accordingly.

Copy link

github-actions bot commented May 16, 2025

conformance test report

apiVersion: gateway.networking.k8s.io/v1
date: "2025-05-16T10:35:29Z"
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:
    - GatewaySecretInvalidReferenceGrant
    - GatewaySecretMissingReferenceGrant
    - HTTPRouteHTTPSListener
    - HTTPRouteInvalidCrossNamespaceBackendRef
    - HTTPRouteInvalidReferenceGrant
    - HTTPRoutePartiallyInvalidViaInvalidReferenceGrant
    - HTTPRouteReferenceGrant
    statistics:
      Failed: 0
      Passed: 26
      Skipped: 7
  name: GATEWAY-HTTP
  summary: Core tests partially succeeded with 7 test skips.

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.

1 participant