Skip to content

Conversation

@AlinsRan
Copy link
Contributor

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

@dspo dspo requested a review from Copilot April 21, 2025 01:16
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 adds support for backend traffic policy in Ingress by augmenting tests and updating the controller and translator modules to handle the new Ingress resource type alongside HTTPRoute. Key changes include:

  • Extending e2e tests with new scenarios for Ingress-backed backend traffic policies.
  • Adding helper functions and predicates to process backend traffic policies.
  • Adjusting resource reconciliation and status update logic in controllers.

Reviewed Changes

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

Show a summary per file
File Description
test/e2e/crds/backendtrafficpolicy.go Extended tests with new Ingress cases and updated test descriptions/log messages.
internal/provider/adc/translator/policies.go Introduced a helper (convertBackendRef) and modified the backend reference matching.
internal/provider/adc/translator/ingress.go Updated logic to use the new helper for backend reference conversion.
internal/controller/policies.go Added a dedicated predicate function for BackendTrafficPolicy events.
internal/controller/ingress_controller.go Enhanced Ingress reconciliation with event channel watches and status updates.
internal/controller/httproute_controller.go Refactored the predicate usage for backend traffic policy events.

Comment on lines 209 to 210
By("create GatewayProxy")
err := s.CreateResourceFromStringWithNamespace(gatewayProxy, "default")
Copy link

Copilot AI Apr 21, 2025

Choose a reason for hiding this comment

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

The log message on this line does not match the resource being created (IngressClass). Please update the log message to correctly reflect that an IngressClass is being created.

Suggested change
By("create GatewayProxy")
err := s.CreateResourceFromStringWithNamespace(gatewayProxy, "default")
By("create IngressClass with GatewayProxy reference")

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reject.

for _, targetRef := range po.Spec.TargetRefs {
if ref.Name == targetRef.Name &&
(ref.Namespace != nil && string(*ref.Namespace) == po.Namespace) {
if ref.Name == targetRef.Name {
Copy link

Copilot AI Apr 21, 2025

Choose a reason for hiding this comment

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

The removal of the namespace check may lead to unintended associations when multiple services share the same name in different namespaces. Consider reintroducing the namespace comparison if services are expected to come from distinct namespaces.

Suggested change
if ref.Name == targetRef.Name {
if ref.Name == targetRef.Name && (ref.Namespace == nil || targetRef.Namespace == nil || string(*ref.Namespace) == targetRef.Namespace) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reject.
targetRef does not have namespace

@AlinsRan AlinsRan requested a review from dspo April 21, 2025 02:18
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 bcb11a7 into release-v2-dev Apr 21, 2025
7 of 8 checks passed
@AlinsRan AlinsRan deleted the feat/ingress-with-backendtrafficpolicy branch April 21, 2025 03:44
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.

4 participants