Documentation
¶
Index ¶
Constants ¶
const ( AnnotationPrefix = "httproute.controller" AnnotationExpose = AnnotationPrefix + "/expose" AnnotationHostname = AnnotationPrefix + "/hostname" AnnotationGateway = AnnotationPrefix + "/gateway" AnnotationGatewayNamespace = AnnotationPrefix + "/gateway-namespace" AnnotationSectionName = AnnotationPrefix + "/section-name" AnnotationPort = AnnotationPrefix + "/port" AnnotationSkipReferenceGrant = AnnotationPrefix + "/skip-reference-grant" FinalizerHTTPRoute = AnnotationPrefix + "/httproute-finalizer" )
Fixed annotation prefix - not configurable
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.3.6
type Config struct {
// DefaultGateway is the default gateway name (REQUIRED)
DefaultGateway string
// DefaultGatewayNamespace is the default gateway namespace (REQUIRED)
DefaultGatewayNamespace string
// DefaultSectionName is the default gateway listener section name
DefaultSectionName string
}
Config holds the controller configuration (required values, no defaults)
type ServiceReconciler ¶
type ServiceReconciler struct {
client.Client
Scheme *runtime.Scheme
Config Config
Recorder record.EventRecorder
}
ServiceReconciler reconciles a Service object
func (*ServiceReconciler) Reconcile ¶
Reconcile implements the reconciliation loop for Service resources. It watches Services with the expose annotation and creates/updates/deletes corresponding HTTPRoute and ReferenceGrant resources.
The reconciler follows modern Kubernetes controller best practices: - Level-based triggers (reconciles full state, not just events) - Idempotent operations (safe to call multiple times) - Finalizers for cross-namespace resource cleanup (HTTPRoute) - OwnerReferences for same-namespace resources (ReferenceGrant) - Cross-namespace resource management via ReferenceGrant
func (*ServiceReconciler) SetupWithManager ¶
func (r *ServiceReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager. Watches Services and owns ReferenceGrant resources. HTTPRoute is NOT owned via OwnerReferences (cross-namespace not supported). Instead, finalizers on Service ensure cleanup of HTTPRoute on deletion. Uses modern controller-runtime patterns: - For() watches the primary resource (Service) - Owns() watches secondary resources for changes (triggers reconciliation of owner)