How freepik-company/customrouter works
CustomRouter is a Kubernetes operator plus an Envoy external processor for dynamic HTTP routing. Users define CustomHTTPRoute rules and an ExternalProcessorAttachment; the operator compiles routing rules into ConfigMaps and generates EnvoyFilters to connect an Istio gateway to the processor. The processor loads and matches routes, then returns routing decisions to Envoy for backend forwarding. The README documents the main control-plane flow; sampled source confirms server setup and ConfigMap loading, while several controller internals were not sampled.
Main entry points: customhttproute/sync.go Route reconciliation · customhttproute_types.go CustomHTTPRoute API · externalprocessorattachment/sync.go Attachment reconciliation · k8s_loader.go ConfigMap route loader
Components 16
Kubernetes control plane
- CustomHTTPRoute API
api/v1alpha1/customhttproute_types.go - Processor attachment API
api/v1alpha1/externalprocessorattachment_types.go - Route admission
internal/webhook/customhttproute_webhook.go - Operator manager
cmd/main.go - Attachment reconciliation
internal/controller/externalprocessorattachment/sync.go - EnvoyFilter generation
internal/controller/envoyfilter/envoyfilter.go
Route compilation
- Route reconciliation
internal/controller/customhttproute/sync.go - Route expansion
pkg/routes/expand.go - Route ConfigMaps
internal/controller/customhttproute/sync.go
External processor
- Processor startup
internal/extproc/server.go - ConfigMap route loader
pkg/routes/k8s_loader.go - Request routing
internal/extproc/router.go
Gateway dataplane
- EnvoyFilter resources
- Istio gateway
- Backend services
Other components
- Route author
Connections 18
- Route author → CustomHTTPRoute API: defines rules
README.md - Route author → Processor attachment API: configures attachment
README.md - CustomHTTPRoute API → Route admission: admission validation
internal/webhook/customhttproute_webhook.go - Operator manager → Route reconciliation: runs reconciliation
- Operator manager → Attachment reconciliation: runs reconciliation
- CustomHTTPRoute API → Route reconciliation: watched by
README.md - Processor attachment API → Attachment reconciliation: watched by
README.md - Route reconciliation → Route expansion: expands rules
- Route reconciliation → Route ConfigMaps: writes routes
README.md - Attachment reconciliation → EnvoyFilter generation: builds filters
- EnvoyFilter generation → EnvoyFilter resources: generates filters
README.md - EnvoyFilter resources → Istio gateway: configures gateway
README.md - Istio gateway → Processor startup: ext_proc call
README.md - Processor startup → ConfigMap route loader: creates loader
internal/extproc/server.go - Route ConfigMaps → ConfigMap route loader: loads routes
README.md - ConfigMap route loader → Request routing: provides routes
internal/extproc/router.go - Request routing → Istio gateway: returns routing decision
README.md - Istio gateway → Backend services: forwards traffic
README.md