Skip to content

Conversation

@biswapanda
Copy link
Contributor

@biswapanda biswapanda commented Jul 17, 2025

Overview:

example routing between different models using inference gateway

Details:

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

Summary by CodeRabbit

  • Documentation

    • Clarified instructions for running the gateway with Minikube, improving guidance on using the tunnel command.
    • Added a new README with step-by-step examples for interacting with an inference gateway serving two models, including sample API requests and responses.
  • New Features

    • Introduced configuration files and deployment examples for serving two models ("google/gemma-3-1b-it" and "Qwen/Qwen3-0.6B") via the inference gateway, including Kubernetes resource definitions for both models and a multi-service deployment setup.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

The changes introduce a new example for serving two models with an inference gateway using Kubernetes resources and documentation. New YAML configuration files and a README are added to demonstrate deploying, configuring, and interacting with two models. Existing instructions for minikube gateway testing are clarified for better usability.

Changes

File(s) Change Summary
deploy/inference-gateway/example/README.md Clarified minikube tunnel usage instructions, advising users to run the tunnel in a dedicated terminal.
deploy/inference-gateway/example/two_models/README.md New README added with step-by-step instructions for interacting with a two-model inference gateway example.
deploy/inference-gateway/example/two_models/inference-model-gemma.yaml Updated InferenceModel resource: renamed to "gemma3" and changed model to "google/gemma-3-1b-it".
deploy/inference-gateway/example/two_models/inference-model-qwen.yaml New InferenceModel resource definition for "Qwen/Qwen3-0.6B" added.
deploy/inference-gateway/example/two_models/two_models.yaml New DynamoGraphDeployment resource defining a deployment with three services: Frontend, GemmaDecodeWorker, QwenDecodeWorker.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Gateway
    participant GemmaWorker
    participant QwenWorker

    User->>Gateway: REST API request (specifies model)
    alt Model = gemma-3-1b-it
        Gateway->>GemmaWorker: Forward inference request
        GemmaWorker-->>Gateway: Model response
    else Model = Qwen3-0.6B
        Gateway->>QwenWorker: Forward inference request
        QwenWorker-->>Gateway: Model response
    end
    Gateway-->>User: Return inference result
Loading

Possibly related PRs

  • fix: vllm router examples #1942: Modifies the same DynamoGraphDeployment resource (vllm-v1-agg) by renaming and adjusting routing flags, closely related to the new multi-model deployment example introduced here.

Poem

In a cluster where models abound,
Two clever minds now can be found.
Gemma and Qwen, side by side,
Await your prompts, with code as their guide.
Kubernetes hums, the gateway replies—
Multi-model magic beneath open skies!
🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
deploy/inference-gateway/example/two_models/two_models.yaml (1)

136-140: Same shell issue for Qwen worker (see Gemma).

🧹 Nitpick comments (4)
deploy/inference-gateway/example/README.md (1)

141-142: Mention privilege requirement for minikube tunnel

minikube tunnel often prompts for sudo/root privileges to create the network route. A quick note avoids user confusion when the command fails silently.

Example:

# start minikube tunnel (may require sudo)
sudo minikube tunnel
deploy/inference-gateway/example/two_models/README.md (2)

1-4: Fix typo and kubectl flag misuse.

  1. “Gatewaty” → “Gateway”.
  2. kubectl can only take one -o; use -o jsonpath=… directly.
-Get Gatewaty URL
+Get Gateway URL
-
-GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}')
+GATEWAY_URL=$(kubectl get svc inference-gateway -o=jsonpath='{.spec.clusterIP}')

35-48: Cluster-IP alone is usually unreachable from your shell.

curl $GATEWAY_URL … will work only inside the cluster network.
For local testing consider:

kubectl port-forward svc/inference-gateway 8000:8000
export GATEWAY_URL=http://localhost:8000

Add a note so users are not blocked.

deploy/inference-gateway/example/two_models/inference-model-qwen.yaml (1)

15-26: Mismatch between pool & model, plus missing newline.

Same pool mismatch as Gemma – update or verify.
YAML-lint also reports a missing trailing newline.

-    name: dynamo-deepseek
+    name: dynamo-qwen   # or the correct pool
+
+# (add a blank line at EOF)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e3e4a0 and f1b206c.

📒 Files selected for processing (5)
  • deploy/inference-gateway/example/README.md (1 hunks)
  • deploy/inference-gateway/example/two_models/README.md (1 hunks)
  • deploy/inference-gateway/example/two_models/inference-model-gemma.yaml (1 hunks)
  • deploy/inference-gateway/example/two_models/inference-model-qwen.yaml (1 hunks)
  • deploy/inference-gateway/example/two_models/two_models.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
deploy/inference-gateway/example/two_models/inference-model-qwen.yaml

[error] 26-26: no new line character at the end of file

(new-line-at-end-of-file)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (1)
deploy/inference-gateway/example/two_models/inference-model-gemma.yaml (1)

18-26: Pool name no longer matches model – verify or rename.

metadata.name and modelName were switched to Gemma, but poolRef.name is still dynamo-deepseek.
If the pool actually points at a DeepSeek-specific worker, routing Gemma traffic there will fail.

-    name: dynamo-deepseek
+    # e.g.
+    name: dynamo-gemma

Please double-check the pool or update the reference to avoid mis-routing.

Comment on lines 145 to 146
GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}')
echo $GATEWAY_URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

kubectl get svc command is broken and returns an unusable IP

kubectl only accepts one -o flag, so -o yaml -o jsonpath=... fails.
Even if the command ran, .spec.clusterIP yields an internal-only address that is not reachable from the host. For a LoadBalancer service via minikube tunnel you need the external IP ( .status.loadBalancer.ingress[0].ip ) or simply use minikube service … --url.

Suggested fix:

-# in a separate terminal
-GATEWAY_URL=$(kubectl get svc inference-gateway -o yaml -o jsonpath='{.spec.clusterIP}')
+# in a separate terminal
+# grab the external IP assigned by the tunnel
+GATEWAY_URL=$(kubectl get svc inference-gateway \
+  -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
 echo $GATEWAY_URL

or, for simplicity:

GATEWAY_URL=$(minikube service inference-gateway --url | head -n1)
🤖 Prompt for AI Agents
In deploy/inference-gateway/example/README.md around lines 145 to 146, the
kubectl command uses multiple -o flags which is invalid and retrieves an
internal cluster IP that is not accessible externally. Replace the command with
one that fetches the external IP from .status.loadBalancer.ingress[0].ip or,
more simply, use the minikube service inference-gateway --url command to get a
reachable gateway URL.

Comment on lines 97 to 103
mainContainer:
image: gitlab-master.nvidia.com:5005/aire/microservices/compoundai/dynamo:1c03404f2624186523529b8d4ca04731b60aa8b9-31776852-vllm_v1-amd64
workingDir: /workspace/examples/vllm
args:
- "python3 components/main.py --model google/gemma-3-1b-it --enforce-eager --endpoint dyn://dynamo.gemma.generate 2>&1 | tee /tmp/vllm.log"
QwenDecodeWorker:
envFromSecret: hf-token-secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Worker args executed without shell – redirection & pipes break.

The whole string is one argv element; 2>&1 | tee … will never be interpreted.

Either wrap with an explicit shell:

command:
  - /bin/sh
  - -c
args:
  - |
    python3 components/main.py --model google/gemma-3-1b-it \
      --enforce-eager --endpoint dyn://dynamo.gemma.generate 2>&1 | tee /tmp/vllm.log

or drop redirection/pipe.

🤖 Prompt for AI Agents
In deploy/inference-gateway/example/two_models/two_models.yaml around lines 97
to 103, the args for mainContainer include shell redirection and piping as a
single argument, which won't work because the command is executed without a
shell. To fix this, replace the args with a command array that runs /bin/sh with
the -c option, and pass the entire python command with redirection and pipe as a
single string argument to the shell. This ensures the shell interprets the
redirection and piping correctly.

Comment on lines 31 to 39
exec:
command:
- /bin/sh
- -c
- "exit 0"
initialDelaySeconds: 60
periodSeconds: 60
timeoutSeconds: 30
failureThreshold: 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Readiness probe always succeeds – loses rollout safety.

command: ["sh","-c","exit 0"] marks every pod ready even when the app is down.
Expose a real health endpoint or remove the probe to let liveness handle restarts.

🤖 Prompt for AI Agents
In deploy/inference-gateway/example/two_models/two_models.yaml around lines 31
to 39, the readiness probe uses a command that always exits with 0, causing the
pod to be marked ready even if the app is down. To fix this, replace the command
with a real health check that verifies the application's readiness, such as an
HTTP GET to a health endpoint, or remove the readiness probe entirely so that
the liveness probe manages pod restarts.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jul 18, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@biswapanda biswapanda marked this pull request as ready for review July 23, 2025 17:56
To test the gateway in minikube, use the following command:
```bash
minikube tunnel &
# start minikube tunnel
Copy link
Contributor

@atchernych atchernych Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 35 has obsolete data:
export DEPLOYMENT_NAME=llm-agg1
yq eval '
.metadata.name = env(DEPLOYMENT_NAME) |
.spec.services[].extraPodSpec.mainContainer.image = env(VLLM_RUNTIME_IMAGE)
' examples/vllm_v0/deploy/agg.yaml > examples/vllm_v0/deploy/agg1.yaml

extraPodSpec:
mainContainer:
image: gitlab-master.nvidia.com:5005/aire/microservices/compoundai/dynamo:1c03404f2624186523529b8d4ca04731b60aa8b9-31776852-vllm_v1-amd64
workingDir: /workspace/examples/vllm
Copy link
Contributor

@atchernych atchernych Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also obsolete paths and "dynamo run"

@biswapanda biswapanda closed this Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants