How haproxytech/haproxy-unified-gateway works
HUG is a Kubernetes gateway controller that translates Gateway API resources (and also has Ingress-related code) into HAProxy configuration and runtime updates. The principal flow is Kubernetes events through reconciliation and route modeling, into HAProxy configuration and map updates, then through the HAProxy client. The README documents Gateway API integration; Ingress support is visible in the source tree, though the README describes it as forthcoming. Edges are limited to relationships shown in excerpts or SOURCE INDEX references; unsampled subsystem links are omitted.
Main entry points: controller.go Controller · controller/main.go Controller entrypoint · tree Gateway and route tree · haproxy/main.go HAProxy app manager
Components 17
Controller runtime
- Controller
k8s/gate/controller.go - Resource status
k8s/gate/status - Controller entrypoint
cmd/controller/main.go
Kubernetes model
- Gateway resources
api/gate/v3 - Ingress resources
k8s/gate/tree/ingress_builder.go - Gateway and route tree
k8s/gate/tree - Reference grants
k8s/gate/tree/reference_grant_manager.go
HAProxy routing
- Route configuration
k8s/gate/haproxy/routes.go - Route maps
k8s/gate/haproxy/routes-maps.go - Map state and files
k8s/gate/haproxy/storage/maps/mapsmanager.go - HAProxy configuration
k8s/gate/haproxy/configuration.go
HAProxy runtime
- HAProxy app manager
hug/haproxy/main.go - HAProxy API client
hug/haproxy/api/client.go - HAProxy process control
hug/haproxy/process/interface.go - Startup configuration
hug/startup/startup.go
Other components
- Kubernetes user
- HAProxy
Connections 18
- Kubernetes user → Gateway resources: creates
- Gateway resources → Controller: watched by
k8s/gate/controller.go - Ingress resources → Controller: watched by
- Controller → Gateway and route tree: reconciles
- Gateway and route tree → Reference grants: checks grants
- Controller → Resource status: updates status
- Gateway and route tree → Route configuration: provides routes
k8s/gate/haproxy/routes.go - Route configuration → Route maps: fills maps
k8s/gate/haproxy/routes.go - Route maps → Map state and files: updates map state
k8s/gate/haproxy/routes-maps.go - Controller → Route configuration: configures routing
- Controller entrypoint → Controller: starts
cmd/controller/main.go - Controller entrypoint → HAProxy app manager: starts
cmd/controller/main.go - Controller entrypoint → HAProxy API client: creates
cmd/controller/main.go - Controller entrypoint → HAProxy process control: creates
cmd/controller/main.go - HAProxy app manager → HAProxy API client: calls
hug/haproxy/main.go - HAProxy app manager → HAProxy process control: controls
hug/haproxy/main.go - HAProxy API client → HAProxy: applies configuration
- Startup configuration → HAProxy configuration: loads initial config
hug/startup/startup.go