# azure/aks-app-routing-operator architecture

> Architecture diagram of the GitHub repository azure/aks-app-routing-operator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azure/aks-app-routing-operator
- Repository: https://github.com/azure/aks-app-routing-operator

## Overview

##### Main Components

a. Core Operator Components:
- Controller Manager (main control loop)
- Custom Resource Definitions (CRDs)
- Reconciliation Logic
- Resource Watchers

b. External Integration Points:
- Azure Key Vault integration
- DNS management (External DNS)
- NGINX Ingress Controller
- Open Service Mesh (OSM) integration
- Prometheus metrics integration

c. Supporting Components:
- Configuration Management
- Manifest Management
- Resource Reconcilers

**┌─ Kubernetes Cluster ──────────────────────────────────────────┐**
- ┌─ AKS Web Application Routing Operator ──────────────────┐   │

- ┌─ Controller Manager ─┐    ┌─ Resource Handlers ─┐   │   │
- Main Control Loop  │    │ - NGINX Ingress     │   │   │
- Metrics Collection │    │ - External DNS      │   │   │
- Event Handling     │    │ - Key Vault         │   │   │
- ┘     │ - OSM               │   │   │
- ┘   │   │
- ┌─ Reconcilers ───────┐    ┌─ Manifests ────────┐    │   │
- Ingress          │    │ - NGINX Config      │    │   │
- Service          │    │ - DNS Config        │    │   │
- Certificate      │    │ - Policy            │    │   │
- ┘      └──────────────────────┘   │   │
- ┘   │

- ┌─ Managed Resources ───────────────────────────────────┐ │
- NGINX Ingress Controllers                           │ │
- DNS Records                                         │ │
- TLS Certificates                                    │ │
- Service Mesh Configuration                          │ │
- ┘ │
- ┘

**┌─ External Azure Services ─────────────────────────────────────┐**
- Azure Key Vault                                            │
- Azure DNS                                                  │
- Azure Container Registry                                   │
- ┘

##### Key Relationships to Highlight
- Controller watching Custom Resources
- Reconciliation loops between controllers and managed resources
- Integration points with Azure services
- Traffic flow through NGINX Ingress
- Certificate and secret management flow
- Metrics collection paths

##### Additional Details
- Version information for supported NGINX versions
- Configuration options for different features
- High availability components
- Optional components (like OSM integration)

##### Notes for Implementation
- Keep the core operator logic centralized
- Clear separation between operator and managed resources
- Declarative nature of the operator
- Monitoring and observability paths
- Security boundaries and authentication flows

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Kubernetes["Kubernetes Cluster"]
        subgraph Operator["AKS Web Application Routing Operator"]
            CM["Controller Manager"]:::core
            click CM "https://github.com/azure/aks-app-routing-operator/blob/main/pkg/controller/controller.go"
            
            subgraph Controllers["Resource Handlers"]
                NIC["NGINX Ingress Controller"]:::handler
                click NIC "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/nginxingress/"
                DNS["DNS Management"]:::handler
                click DNS "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/dns/"
                KV["Key Vault Integration"]:::handler
                click KV "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/keyvault/"
                OSM["Open Service Mesh"]:::handler
                click OSM "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/osm/"
            end
            
            subgraph Reconcilers["Resource Reconcilers"]
                IR["Ingress Reconciler"]:::reconciler
                click IR "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/ingress/"
                SR["Service Reconciler"]:::reconciler
                click SR "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/controller/service/"
                RR["Resource Reconciler"]:::reconciler
                click RR "https://github.com/azure/aks-app-routing-operator/blob/main/pkg/controller/common/resource_reconciler.go"
            end
            
            subgraph Resources["Resource Definitions"]
                CRD["Custom Resource Definitions"]:::resource
                click CRD "https://github.com/azure/aks-app-routing-operator/blob/main/config/crd/bases/approuting.kubernetes.azure.com_nginxingresscontrollers.yaml"
                RT["Resource Types"]:::resource
                click RT "https://github.com/azure/aks-app-routing-operator/blob/main/api/v1alpha1/nginxingresscontroller_types.go"
            end
            
            subgraph Config["Configuration"]
                MM["Manifest Management"]:::config
                click MM "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/manifests/"
                CM_CONFIG["Configuration Management"]:::config
                click CM_CONFIG "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/config/"
                PM["Policy Management"]:::config
                click PM "https://github.com/azure/aks-app-routing-operator/tree/main/pkg/manifests/policy/"
            end
            
            METRICS["Prometheus Metrics"]:::monitoring
            click METRICS "https://github.com/azure/aks-app-routing-operator/blob/main/pkg/controller/metrics/metrics.go"
        end
        
        subgraph ManagedRes["Managed Resources"]
            NGINX["NGINX Ingress Controllers"]:::managed
            DNS_REC["DNS Records"]:::managed
            CERT["TLS Certificates"]:::managed
            MESH["Service Mesh Config"]:::managed
        end
    end
    
    subgraph Azure["External Azure Services"]
        AKV["Azure Key Vault"]:::azure
        ADNS["Azure DNS"]:::azure
        ACR["Azure Container Registry"]:::azure
    end
    
    %% Relationships
    CM --> Controllers
    CM --> Reconcilers
    CM --> METRICS
    Controllers --> ManagedRes
    Reconcilers --> ManagedRes
    KV --> AKV
    DNS --> ADNS
    NIC --> ACR
    
    %% Styles
    classDef core fill:#2374e1,stroke:#164b94,color:#fff
    classDef handler fill:#37a2eb,stroke:#2374e1,color:#fff
    classDef reconciler fill:#4287f5,stroke:#2374e1,color:#fff
    classDef resource fill:#6ea8fe,stroke:#2374e1,color:#fff
    classDef config fill:#95c5fe,stroke:#2374e1,color:#fff
    classDef monitoring fill:#b8d7fe,stroke:#2374e1,color:#fff
    classDef managed fill:#48c78e,stroke:#257953,color:#fff
    classDef azure fill:#ff8c00,stroke:#cc7000,color:#fff
```
