How azure/application-gateway-kubernetes-ingress works
AGIC watches selected Kubernetes resources, converts ingress intent into Application Gateway configuration, and reconciles that configuration with Azure ARM. Ingress events are queued and processed by a worker/controller; gateway configuration covers routing, TLS, affinity, and other L7 behavior. Brownfield handling preserves or filters existing gateway resources, while separate code supports Istio, multicluster resources, CNI reconciliation, metrics, and health endpoints. The README documents the core workflow and features; several subsystem links below are omitted where sampled source does not show their runtime wiring.
Main entry points: controller.go Ingress controller · main.go AGIC process · context.go Resource context · configbuilder.go Gateway config builder
Components 21
Kubernetes inputs
- Kubernetes resources
- Custom resource APIs
pkg/apis - Resource context
pkg/k8scontext/context.go - Ingress handlers
pkg/k8scontext/ingress_handlers.go - Ingress annotations
pkg/annotations/ingress_annotations.go - Multicluster integration
pkg/crd_client/azure_multicluster_crd_client/clientset/versioned/clientset.go
Reconciliation
- Event queue
pkg/events/events.go - Event worker
pkg/worker/worker.go - Ingress controller
pkg/controller/controller.go - Brownfield pruning
pkg/controller/prune.go
Gateway configuration
- Existing gateway state
pkg/brownfield/routing_rules.go - Gateway config builder
pkg/appgw/configbuilder.go - Routing rules
pkg/appgw/requestroutingrules.go - Azure client
pkg/azure/client.go - Istio integration
pkg/appgw/istio_config.go
Operations
- CNI reconciliation
pkg/cni/cni.go - Metrics store
pkg/metricstore/metricstore.go - Health and metrics HTTP
pkg/httpserver/httpserver.go - AGIC process
cmd/appgw-ingress/main.go
Other components
- Cluster operator
- Azure Resource Manager
Connections 23
- Cluster operator → Kubernetes resources: defines resources
README.md - Kubernetes resources → Resource context: monitors changes
README.md - Resource context → Ingress handlers: dispatches events
- Ingress handlers → Event queue: queues changes
pkg/k8scontext/ingress_handlers.go - Ingress annotations → Routing rules: configures routing
pkg/appgw/requestroutingrules.go - Event queue → Event worker: supplies work
pkg/worker/worker.go - Ingress controller → Resource context: starts context
pkg/controller/controller.go - Ingress controller → CNI reconciliation: reconciles CNI
pkg/controller/controller.go - Ingress controller → Azure client: gets gateway
pkg/controller/controller.go - Event worker → Ingress controller: processes events
- Ingress controller → Gateway config builder: builds configuration
- Ingress controller → Brownfield pruning: prunes resources
- Brownfield pruning → Existing gateway state: filters existing rules
pkg/controller/prune.go - Gateway config builder → Routing rules: builds routing
pkg/appgw/requestroutingrules.go - Azure client → Azure Resource Manager: updates gateway
pkg/azure/client.go - AGIC process → Ingress controller: starts controller
cmd/appgw-ingress/main.go - AGIC process → Resource context: constructs context
cmd/appgw-ingress/main.go - AGIC process → Health and metrics HTTP: starts server
cmd/appgw-ingress/main.go - AGIC process → Metrics store: starts metrics
cmd/appgw-ingress/main.go - AGIC process → Multicluster integration: creates client
cmd/appgw-ingress/main.go - Resource context → Custom resource APIs: uses resource types
pkg/k8scontext/context.go - Gateway config builder → Istio integration: supports Istio
- Health and metrics HTTP → Metrics store: exposes metrics
pkg/httpserver/httpserver.go