-
Notifications
You must be signed in to change notification settings - Fork 447
Open
Description
Summary
Add support for PreferHTTPRoute field in ClientConfig to allow operator to communicate with Grafana instance via HTTPRoute instead of Service, similar to existing PreferIngress functionality.
Motivation
When using Gateway API HTTPRoutes, the operator currently communicates with Grafana through the Service. However, in some scenarios (similar to Ingress use cases), it would be beneficial to communicate through the HTTPRoute to:
- Validate that the HTTPRoute is correctly configured
- Test the full ingress path including Gateway rules and filters
- Ensure end-to-end connectivity works as expected
Proposed Implementation
1. Add PreferHTTPRoute Field
type ClientConfig struct {
// ... existing fields ...
PreferHTTPRoute *bool `json:"preferHTTPRoute,omitempty"`
}2. Gateway Protocol Detection
Implement Gateway lookup to determine correct protocol (HTTP/HTTPS):
- Look up Gateway resource from HTTPRoute.Spec.ParentRefs
- Find matching Listener by SectionName
- Detect protocol from Listener.Protocol or Listener.TLS configuration
- Fallback to hostname from HTTPRoute.Spec.Hostnames
3. AdminURL Construction
Build admin URL using detected protocol and hostname for operator-to-Grafana communication.
Complexity Considerations
This feature requires:
- Additional RBAC permissions to read Gateway resources
- Complex logic to match listeners and detect protocols
- Proper error handling for missing/incomplete Gateway information
- Comprehensive test coverage
Related
- Initial HTTPRoute support: feat(ingress): add HTTPRoute support for Grafana instances #2283 (removed this functionality to keep PR focused)
- Similar functionality exists for Ingress:
PreferIngressfield
Questions for Discussion
- Is this functionality needed for HTTPRoute support, or is Service-based communication sufficient?
- Should we support fallback scenarios (e.g., Gateway not found)?
- What should be the behavior when multiple parentRefs are defined?
- Should we also support extracting hostname from Gateway status if not specified in HTTPRoute?
Baarsgaard
Metadata
Metadata
Assignees
Labels
No labels