%% Component Structure Diagram - llm-d-inference-scheduler
%% Generated by: Claude Opus 4.6
%% Source: architecture/rhoai-2.24/llm-d-inference-scheduler.md

graph TB
    subgraph EPP["EPP (Endpoint Picker) Service"]
        direction TB
        Main[EPP Main<br/>gRPC Server<br/>9002/TCP]
        PluginRegistry[Plugin Registry]

        subgraph Filters["Filter Plugins"]
            ByLabel[ByLabel Filter]
            ByLabelSelector[ByLabelSelector Filter]
            DecodeFilter[Decode Filter<br/>role=decode/both]
            PrefillFilter[Prefill Filter<br/>role=prefill]
        end

        subgraph Scorers["Scorer Plugins"]
            PrefixCache[PrefixCache Scorer<br/>estimate mode]
            PrefixCacheTracking[PrefixCacheTracking Scorer<br/>cache_tracking mode]
            LoadAware[LoadAware Scorer<br/>queue depth]
            SessionAffinity[SessionAffinity Scorer<br/>x-session-token]
        end

        subgraph ProfileHandlers["Profile & Pre-Request Plugins"]
            PdProfileHandler[PdProfileHandler<br/>P/D profile selection]
            PrefillHeaderHandler[PrefillHeaderHandler<br/>x-prefiller-host-port]
        end

        Main --> PluginRegistry
        PluginRegistry --> Filters
        PluginRegistry --> Scorers
        PluginRegistry --> ProfileHandlers
    end

    %% External Interactions
    Client[Client] -->|HTTP/80| Gateway["Envoy Gateway<br/>(inference-gateway)"]
    Gateway -->|gRPC ext-proc<br/>9002/TCP| Main

    %% CRDs Watched
    InferencePoolCR["InferencePool CR<br/>inference.networking.x-k8s.io/v1alpha2"]
    InferenceModelCR["InferenceModel CR<br/>inference.networking.x-k8s.io/v1alpha2"]
    GatewayCR["Gateway CR<br/>gateway.networking.k8s.io/v1"]
    HTTPRouteCR["HTTPRoute CR<br/>gateway.networking.k8s.io/v1"]

    Main -->|watches| InferencePoolCR
    Main -->|watches| InferenceModelCR
    Gateway -->|configured by| GatewayCR
    Gateway -->|routes via| HTTPRouteCR

    %% Backend
    Gateway -->|HTTP/8000<br/>routed by EPP| vLLMPods["vLLM Model-Serving Pods"]

    %% Optional Dependencies
    PrefixCacheTracking -->|ZMQ SUB<br/>5557/TCP| KVCacheManager["llm-d-kv-cache-manager"]
    Main -->|HTTPS/443| K8sAPI["Kubernetes API Server"]

    %% Monitoring
    Prometheus["Prometheus"] -->|HTTP scrape<br/>9090/TCP| Main

    %% Istio
    Istio["Istio Control Plane<br/>(istiod-llm-d-gateway)"] -->|xDS/15010| Gateway

    %% Styling
    style Main fill:#4a90e2,stroke:#333,stroke-width:2px,color:#fff
    style PluginRegistry fill:#4a90e2,stroke:#333,color:#fff
    style ByLabel fill:#5ba3f5,stroke:#333,color:#fff
    style ByLabelSelector fill:#5ba3f5,stroke:#333,color:#fff
    style DecodeFilter fill:#5ba3f5,stroke:#333,color:#fff
    style PrefillFilter fill:#5ba3f5,stroke:#333,color:#fff
    style PrefixCache fill:#6db3ff,stroke:#333,color:#fff
    style PrefixCacheTracking fill:#6db3ff,stroke:#333,color:#fff
    style LoadAware fill:#6db3ff,stroke:#333,color:#fff
    style SessionAffinity fill:#6db3ff,stroke:#333,color:#fff
    style PdProfileHandler fill:#7ec4ff,stroke:#333
    style PrefillHeaderHandler fill:#7ec4ff,stroke:#333
    style InferencePoolCR fill:#f5a623,stroke:#333
    style InferenceModelCR fill:#f5a623,stroke:#333
    style GatewayCR fill:#f5a623,stroke:#333
    style HTTPRouteCR fill:#f5a623,stroke:#333
    style Gateway fill:#e8e8e8,stroke:#333
    style Istio fill:#e8e8e8,stroke:#333
    style K8sAPI fill:#e8e8e8,stroke:#333
    style vLLMPods fill:#7ed321,stroke:#333
    style KVCacheManager fill:#7ed321,stroke:#333
    style Prometheus fill:#e8e8e8,stroke:#333
    style Client fill:#f9f9f9,stroke:#333
