-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Add support for Secret resources in Gateway reconciliation #119
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: Add support for Secret resources in Gateway reconciliation #119
Conversation
Refactored the `SetupIndexer` function to use a loop for registering indexers, added a new `setupGatewaySecretIndex` function, and implemented secret watching in the Gateway reconciler. These changes improve code maintainability and enable dynamic reconciliation of Gateways when referenced secrets are updated.
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 introduces support for Secret resources within Gateway reconciliation, alongside minor naming corrections and additional indexing/watching of Secret objects. Key changes include:
- Fixing typos in variable names within end-to-end test files.
- Adding a new secret indexer and corresponding indexing function in the controller.
- Updating the Gateway controller to watch and reconcile Secret resources.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/e2e/gatewayapi/gateway.go | Corrected variable naming typos and added secret update tests. |
| internal/controller/utils.go | Added a helper (FullTypeName) and defined KindSecret constant. |
| internal/controller/indexer/indexer.go | Introduced new secret indexer functions to support Secret resource lookup. |
| internal/controller/gateway_controller.go | Updated manager setup to watch Secrets and handle them in reconciliation. |
Comments suppressed due to low confidence (1)
internal/controller/gateway_controller.go:46
- [nitpick] Add a code comment explaining the rationale for including Secret objects in the watch predicate to aid future maintainers.
WithEventFilter(predicate.Or(predicate.GenerationChangedPredicate{}, predicate.NewPredicateFuncs(func(obj client.Object) bool {
| } | ||
| return nil | ||
| } | ||
|
|
Copilot
AI
Apr 30, 2025
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.
[nitpick] Consider adding inline documentation for setupGatewaySecretIndex to clarify its purpose and expected behavior for indexing Secret resources.
| // setupGatewaySecretIndex creates an index for Gateway resources based on their associated Secrets. | |
| // This index allows quick lookups of Gateways that reference specific Secrets, using the custom | |
| // GatewaySecretIndexFunc to generate the index keys. |
conformance test reportapiVersion: gateway.networking.k8s.io/v1
date: "2025-04-30T07:45:57Z"
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. |
Type of change:
What this PR does / why we need it:
chore: Add support for Secret resources in Gateway reconciliation
Pre-submission checklist: