-
Notifications
You must be signed in to change notification settings - Fork 2
chore: httproutepolicy status on targetref deleting #111
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
chore: httproutepolicy status on targetref deleting #111
Conversation
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-04-27T04:55:12Z"
gatewayAPIChannel: standard
gatewayAPIVersion: v1.2.0
implementation:
contact: null
organization: API7
project: api7-ingress-controller
url: https://github.com/api7/api7-ingress-controller.git
version: v2.0.0
kind: ConformanceReport
mode: default
profiles:
- core:
result: partial
skippedTests:
- GatewayInvalidTLSConfiguration
- GatewaySecretInvalidReferenceGrant
- GatewaySecretMissingReferenceGrant
- GatewaySecretReferenceGrantAllInNamespace
- GatewaySecretReferenceGrantSpecific
- HTTPRouteExactPathMatching
- HTTPRouteHTTPSListener
- HTTPRouteHeaderMatching
- HTTPRouteHostnameIntersection
- HTTPRouteInvalidBackendRefUnknownKind
- HTTPRouteInvalidCrossNamespaceBackendRef
- HTTPRouteInvalidCrossNamespaceParentRef
- HTTPRouteInvalidNonExistentBackendRef
- HTTPRouteInvalidParentRefNotMatchingSectionName
- HTTPRouteInvalidReferenceGrant
- HTTPRouteListenerHostnameMatching
- HTTPRouteMatching
- HTTPRouteMatchingAcrossRoutes
- HTTPRoutePartiallyInvalidViaInvalidReferenceGrant
- HTTPRouteReferenceGrant
- HTTPRouteRequestHeaderModifier
- HTTPRouteWeight
statistics:
Failed: 0
Passed: 11
Skipped: 22
name: GATEWAY-HTTP
summary: Core tests partially succeeded with 22 test skips. |
Add logic to update HTTPRoutePolicy status when associated Ingress or HTTPRoute resources are deleted. Introduce new methods to handle status updates and remove ancestor references, along with corresponding e2e tests for ingress and gateway API scenarios.
There was a problem hiding this 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 is a chore that improves the handling and status updates of HTTPRoutePolicy resources when their associated Ingress or HTTPRoute is deleted. The key changes include:
- Adding new e2e tests to verify that HTTPRoutePolicy status updates correctly on target resource deletion.
- Refactoring the internal data structures and functions to use slices instead of maps for HTTPRoutePolicies.
- Updating index functions and controller logic to accommodate these changes.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/ingress/ingress.go | New tests for verifying HTTPRoutePolicy status on Ingress deletion |
| test/e2e/gatewayapi/httproute.go | Updated tests for HTTPRoute deletion handling |
| internal/provider/provider.go | Changed HTTPRoutePolicies from a map to a slice to support new processing logic |
| internal/provider/adc/translator/httproute.go | Adjusted logic for filtering HTTPRoutePolicies for HTTPRoute and Ingress |
| internal/controller/* | Updated indexing, reconciliation, and status update functions for HTTPRoutePolicy |
Comments suppressed due to low confidence (3)
internal/provider/provider.go:41
- Switching HTTPRoutePolicies from a map to a slice changes how policies are accessed; please verify that all methods relying on keyed lookups are updated correctly to iterate through the slice.
HTTPRoutePolicies: []v1alpha1.HTTPRoutePolicy
internal/controller/httproute_controller.go:519
- [nitpick] Ensure that using slices.DeleteFunc to filter discardsRefs preserves the intended order of targetRefs if the order is significant for subsequent processing.
discardsRefs := slices.DeleteFunc(oldPolicy.Spec.TargetRefs, func(oldRef v1alpha2.LocalPolicyTargetReferenceWithSectionName) bool {
internal/controller/httproutepolicy.go:183
- [nitpick] Using metav1.Now() is consistent with Kubernetes API conventions, but please double-check that this timestamp approach aligns with other parts of the codebase that might use time.Now() for condition timestamps.
LastTransitionTime: metav1.Now(),
Rename `isPoliciesConflict` to `checkPoliciesConflict` for clarity and improve related functions for better readability and accuracy. Update method names and logic for deleting ancestors and finding matching policies, while also optimizing the status update process for deleted HTTPRoute resources.
Type of change:
What this PR does / why we need it:
Add logic to update HTTPRoutePolicy status when associated Ingress or HTTPRoute resources are deleted. Introduce new methods to handle status updates and remove ancestor references, along with corresponding e2e tests for ingress and gateway API scenarios.
Pre-submission checklist: