graph LR
    KubeRay[KubeRay Operator]

    %% External Dependencies (Required)
    KubeRay -->|container orchestration<br/>resource management| Kubernetes[Kubernetes 1.28.4+]
    KubeRay -->|controller framework| ControllerRuntime[controller-runtime 0.16.3]
    KubeRay -->|programming language| Go[Go 1.22.2]

    %% External Dependencies (Optional)
    KubeRay -.->|Routes, SCCs| OpenShift[OpenShift API]
    KubeRay -.->|gang scheduling| Volcano[Volcano Scheduler 1.6.0-alpha]
    KubeRay -.->|TLS certificates| CertManager[cert-manager]

    %% External Services
    KubeRay -->|API server| K8sAPI[Kubernetes API<br/>443/TCP HTTPS]
    KubeRay -->|pull images| Registry[Container Registry<br/>443/TCP HTTPS]
    RayCluster -.->|fault tolerance| ExternalStorage[External Storage<br/>Redis/S3<br/>443/TCP HTTPS]

    %% Monitoring Integration
    Prometheus[Prometheus] -->|scrape metrics<br/>8080/TCP HTTP| KubeRay
    Prometheus -->|scrape metrics<br/>8080/TCP HTTP| RayCluster

    %% Ray Cluster (Managed)
    KubeRay -->|creates/manages| RayCluster[Ray Cluster<br/>Head + Workers]

    %% Internal ODH/RHOAI Integration Points
    KubeRay -.->|can be used by| DSPipelines[Data Science Pipelines]
    KubeRay -.->|can be used by| Notebooks[Jupyter Notebooks]
    KubeRay -.->|can be used by| TrainingOperator[Training Operator]

    %% User Interaction
    User[Data Scientist] -->|creates CRs| KubeRay
    User -->|submits jobs| RayCluster

    %% Grouping and Styling
    style KubeRay fill:#4a90e2,stroke:#333,stroke-width:4px
    style RayCluster fill:#4a90e2,stroke:#333,stroke-width:2px

    style Kubernetes fill:#326ce5,stroke:#333,stroke-width:2px
    style ControllerRuntime fill:#326ce5,stroke:#333
    style Go fill:#00add8,stroke:#333

    style OpenShift fill:#cc0000,stroke:#333,stroke-dasharray: 5 5
    style Volcano fill:#999,stroke:#333,stroke-dasharray: 5 5
    style CertManager fill:#999,stroke:#333,stroke-dasharray: 5 5

    style K8sAPI fill:#f5a623,stroke:#333
    style Registry fill:#f5a623,stroke:#333
    style ExternalStorage fill:#f5a623,stroke:#333,stroke-dasharray: 5 5

    style Prometheus fill:#e6522c,stroke:#333

    style DSPipelines fill:#7ed321,stroke:#333,stroke-dasharray: 5 5
    style Notebooks fill:#7ed321,stroke:#333,stroke-dasharray: 5 5
    style TrainingOperator fill:#7ed321,stroke:#333,stroke-dasharray: 5 5

    style User fill:#08427b,stroke:#333
