How kubernetes-sigs/controller-runtime works
Main Components
a) Core Components:
• Manager Component (pkg/manager)
• Controller Component (pkg/controller)
• Cache Component (pkg/cache)
• Client Component (pkg/client)
• Webhook Component (pkg/webhook)
• Metrics Component (pkg/metrics)
b) Supporting Components:
• Certificate Watcher (pkg/certwatcher)
• Event Handling System (pkg/event)
• Reconciliation Engine (pkg/reconcile)
• Source Management (pkg/source)
• Predicate Handling (pkg/predicate)
┌─────────────────────────────────────────────────────────┐
• Client Layer │
• ┤
• Manager Layer │
• ┬───────────────┬────────────────────────┤
• Controllers │ Cache │ Webhooks │
• ┴───────────────┴────────────────────────┤
• Kubernetes API Server │
• ┘
Detailed Component Breakdown
Manager Component:
┌─────────── Manager ──────────┐
• ┌─────────┐ ┌──────────┐ │
• Cache │ │Controllers│ │
• ┘ └──────────┘ │
• ┌─────────┐ ┌──────────┐ │
• Webhooks │ │ Metrics │ │
• ┘ └──────────┘ │
• ┘
Key Interactions to Highlight
• Controller ↔ Cache: Watch and Get operations
• Controller → Reconciler: Reconciliation requests
• Webhook ↔ API Server: Admission and conversion
• Manager → All Components: Lifecycle management
• Cache ↔ API Server: Data synchronization
Additional Elements
Annotations for:
• Configuration options
• Health check endpoints
• Metrics collection points
• Leader election mechanisms
• Resource watching patterns
Implementation Notes
• Maintain consistent spacing and alignment
• Version compatibility information
• Notes about extension points
• Document common patterns and flows