Skip to content

[Bugfix] Match KEDA scalers to enabled model deployments - #1142

Merged
ruizhang0101 merged 2 commits into
vllm-project:mainfrom
bojiang-li:fix/keda-deployment-guards
Oct 23, 2026
Merged

ruizhang0101 merged 2 commits into
vllm-project:mainfrom
bojiang-li:fix/keda-deployment-guards

Conversation

@bojiang-li

Copy link
Copy Markdown
Contributor

Summary

Align KEDA ScaledObject creation with the model Deployment conditions. With raySpec.enabled: false, the Deployment currently omits replicas for KEDA but no ScaledObject is rendered. Disabled models have the opposite problem: an orphan ScaledObject targets a Deployment that is not rendered.

Check the Ray enabled flag instead of the presence of the Ray configuration, and skip disabled models. Enabled Ray models remain excluded.

Validation

On DGX Spark with Helm 3.18.5 and helm-unittest 0.8.2:

helm unittest helm
helm lint helm
pre-commit run --files helm/templates/scaledobject-vllm.yaml helm/tests/keda_test.yaml

All 148 tests in 24 suites pass, including seven KEDA tests. The original template fails the two new regression cases. Lint passes with warnings about optional chart dependencies not being downloaded. Changed file pre-commit checks pass. No live Kubernetes cluster rollout was performed.

Duplicate searches for KEDA raySpec, KEDA disabled, and open replica related PRs found no matching fix.

AI assistance: implemented and tested with Codex. Human review is pending.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Helm templates to prevent creating KEDA ScaledObjects for disabled models or when Ray is enabled, and adds corresponding unit tests to verify these scenarios. Feedback is provided regarding a potential nil pointer evaluation error in the template when raySpec is explicitly set to null or ~, with a suggestion to use a safer and more idiomatic conditional check.

Comment thread helm/templates/scaledobject-vllm.yaml Outdated
{{- if ne $modelSpec.enabled false }}
{{- if and (hasKey $modelSpec "keda") $modelSpec.keda.enabled }}
{{- if not (hasKey $modelSpec "raySpec") }}
{{- if not (and (hasKey $modelSpec "raySpec") $modelSpec.raySpec.enabled) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using hasKey combined with a direct property access can lead to a template rendering error if raySpec is explicitly set to null or ~ in the values file. In Go templates, hasKey returns true if the key exists, even if its value is nil. Evaluating $modelSpec.raySpec.enabled when $modelSpec.raySpec is nil will result in a nil pointer evaluation error. Using the and operator directly with $modelSpec.raySpec is safer and more idiomatic, as it safely short-circuits if raySpec is missing or nil.

{{- if not (and $modelSpec.raySpec $modelSpec.raySpec.enabled) }}

Assisted-by: Codex
Signed-off-by: bojiang-li <[email protected]>
@bojiang-li

Copy link
Copy Markdown
Contributor Author

Fixed in 6a0b890. The ScaledObject, Deployment, and RayCluster guards all handle a null raySpec, so rendering the full chart also works. Added a regression for null raySpec with KEDA enabled. All 149 Helm tests across 24 suites pass on DGX Spark. Helm lint reports no errors.

@ruizhang0101 ruizhang0101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@bojiang-li

Copy link
Copy Markdown
Contributor Author

Thanks @ruizhang0101 for the review. I checked the remaining CI failure: Secure-Minimal-Example times out connecting to the runner's Kubernetes API during the initial Helm uninstall. Dependency setup, deployment, and validation are all skipped, so the failure happens before this change is deployed. Helm unit tests, pre-commit, and Helm lint are green.

I tried rerunning the failed jobs, but GitHub requires repository admin rights. Could you check the test cluster and rerun the workflow when it is reachable? Thanks!

https://github.com/vllm-project/production-stack/actions/runs/38854543099/job/117173940742

@ruizhang0101
ruizhang0101 merged commit cc81411 into vllm-project:main Oct 23, 2026
19 of 23 checks passed
bcdonadio added a commit to powerhome/vllm-production-stack that referenced this pull request Nov 12, 2026
* [Bugfix][Router] Read vllm:kv_cache_usage_perc for KV cache usage (vllm-project#1118)

Signed-off-by: Muhammad Ibrahim <[email protected]>

* [Doc] Add Simplified Chinese translation (README.zh.md) (vllm-project#1136)

Signed-off-by: YE <[email protected]>

* [CI/Build] Run helm unittest in CI and fix two broken tests (vllm-project#1131)

Signed-off-by: zjjkee <[email protected]>

* [Bugfix][Router] Key request stats by dispatch, not by X-Request-Id (vllm-project#1115)

Signed-off-by: David-Wu1119 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>

* [Bugfix][Router] Use least-inflight for PrefixAware below-threshold fallback (vllm-project#1089)

Signed-off-by: Dundy Pasupuleti <[email protected]>

* [Bugfix][Router] Keep P/D model labels when dynamic config reloads the router (vllm-project#1129)

Signed-off-by: MinJun Choi <[email protected]>

* [Bugfix] Match KEDA scalers to enabled model deployments (vllm-project#1142)

Signed-off-by: bojiang-li <[email protected]>

* [Router] added pooling route (vllm-project#1112)

Signed-off-by: [email protected] <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>

* [CI] Drop host docker prune from runner-cleanup workflow (vllm-project#1174)

Signed-off-by: Rui Zhang <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* [Feat][Router] Add /v1/systemone and /v1/decisions routes (vllm-project#1173)

Signed-off-by: Shern Shiou Tan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* [CI/Build] Stop k8s routing tests when the engine pods never become ready (vllm-project#1134)

Signed-off-by: MinJun Choi <[email protected]>

* [Bugfix][Router] Upgrade aiohttp and vllm (0.33.0) to resolve router image CVEs (vllm-project#1185)

Signed-off-by: Shern Shiou Tan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* Bump chart version to 0.1.14 (vllm-project#1190)

Signed-off-by: Rui Zhang <[email protected]>

---------

Signed-off-by: Muhammad Ibrahim <[email protected]>
Signed-off-by: YE <[email protected]>
Signed-off-by: zjjkee <[email protected]>
Signed-off-by: David-Wu1119 <[email protected]>
Signed-off-by: Dundy Pasupuleti <[email protected]>
Signed-off-by: MinJun Choi <[email protected]>
Signed-off-by: bojiang-li <[email protected]>
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: Rui Zhang <[email protected]>
Signed-off-by: Shern Shiou Tan <[email protected]>
Signed-off-by: MinJun Choi <[email protected]>
Signed-off-by: Rui Zhang <[email protected]>
Signed-off-by: Bernardo Donadio <[email protected]>
Co-authored-by: Muhammad Ibrahim <[email protected]>
Co-authored-by: YE <[email protected]>
Co-authored-by: Jingke zou <[email protected]>
Co-authored-by: Yanze (David) Wu <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Rui Zhang <[email protected]>
Co-authored-by: Dundy Pasupuleti <[email protected]>
Co-authored-by: MinJun Choi <[email protected]>
Co-authored-by: Bojiang Li <[email protected]>
Co-authored-by: MaelvanDijk <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Shern Shiou Tan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants