# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: nvidia.com/v1alpha1
kind: DynamoGraphDeployment
metadata:
  name: sglang-disagg
spec:
  services:
    Frontend:
      dynamoNamespace: sglang-disagg
      componentType: frontend
      replicas: 1
      extraPodSpec:
        mainContainer:
          image: my-registry/sglang-runtime:my-tag
    SGLangDecodeWorker:
      envFromSecret: hf-token-secret
      dynamoNamespace: sglang-disagg
      componentType: worker
      replicas: 1
      resources:
        limits:
          gpu: "1"
      extraPodSpec:
        mainContainer:
          image: my-registry/sglang-runtime:my-tag
          workingDir: /workspace/components/backends/sglang
          command:
            - /bin/sh
            - -c
          args:
            - >-
              python3 -m dynamo.sglang
              --model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B
              --served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B
              --page-size 16
              --tp 1
              --trust-remote-code
              --skip-tokenizer-init
              --disaggregation-mode decode
              --disaggregation-transfer-backend nixl

    SGLangPrefillWorker:
      envFromSecret: hf-token-secret
      dynamoNamespace: sglang-disagg
      componentType: worker
      replicas: 1
      resources:
        limits:
          gpu: "1"
      extraPodSpec:
        mainContainer:
          image: my-registry/sglang-runtime:my-tag
          workingDir: /workspace/components/backends/sglang
          command:
            - /bin/sh
            - -c
          args:
            - >-
              python3 -m dynamo.sglang
              --model-path deepseek-ai/DeepSeek-R1-Distill-Llama-8B
              --served-model-name deepseek-ai/DeepSeek-R1-Distill-Llama-8B
              --page-size 16
              --tp 1
              --trust-remote-code
              --skip-tokenizer-init
              --disaggregation-mode prefill
              --disaggregation-transfer-backend nixl
