vllm - ✅(Solved) Fix [Feature]: support affinity settings in helm chart [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#38308Fetched 2026-04-08 01:36:36
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #38310: [Doc] Support configuring affinity in helm chart

Description (problem / solution / changelog)

Purpose

Fixes #38308

This PR updates examples/online_serving/chart-helm to support generic affinity configuration via values.yaml.

Previously, the specific nodeAffinity was created by gpuModels in values.yaml, and pinning GPU product labels by gpuModels was mandatory.

This change enables the following use cases:

  • The case where users want to specify podAffinity
  • The case where users want to specify podAntiAffinity
  • The case where users want to specify generic nodeAffinity
  • The case where users do not want to explicitly pin GPU product labels

Test Plan

1. Helm chart validation

  • helm lint examples/online_serving/chart-helm
  • helm unittest examples/online_serving/chart-helm

2. Render validation

  • helm template test examples/online_serving/chart-helm
  • helm template test examples/online_serving/chart-helm -f ~/values-affinity.yaml
  • helm template test examples/online_serving/chart-helm -f ~/values-gpumodels.yaml
# ~/values-affinity.yaml
affinity:
  podAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - topologyKey: kubernetes.io/hostname
        labelSelector:
          matchExpressions:
            - key: app
              operator: In
              values:
                - vllm
# ~/values-gpumodels.yaml
gpuModels:
  - NVIDIA-A100-PCIE-40GB-SHARED

Test Result

[x] Helm chart validation passed [x] Render validation passed

  • custom affinity is rendered when provided
  • gpuModels nodeAffinity is rendered only when affinity is not set
$ helm unittest .

### Chart [ chart-vllm ] .

 PASS  test deployment  tests/deployment_test.yaml
 PASS  test job tests/job_test.yaml
 PASS  test pvc tests/pvc_test.yaml

Charts:      1 passed, 1 total
Test Suites: 3 passed, 3 total
Tests:       8 passed, 8 total
Snapshot:    0 passed, 0 total
Time:        58.870428ms

<details> <summary> Essential Elements of an Effective PR Description Checklist </summary>
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.
</details>

Changed files

  • docs/deployment/frameworks/helm.md (modified, +1/-0)
  • examples/online_serving/chart-helm/templates/deployment.yaml (modified, +8/-2)
  • examples/online_serving/chart-helm/tests/deployment_test.yaml (modified, +38/-1)
  • examples/online_serving/chart-helm/values.schema.json (modified, +4/-2)
  • examples/online_serving/chart-helm/values.yaml (modified, +16/-3)
RAW_BUFFERClick to expand / collapse

🚀 The feature, motivation and pitch

Problem

This issue concerns chart-helm.

This Helm Chart does not support configuring affinity for Deployment/Pod.

Currently, the following use cases are not supported:

  • The case where users want to specify podAffinity
  • The case where users want to specify podAntiAffinity
  • The case where users want to specify generic nodeAffinity (Currently, the specific nodeAffinity is created by gpuModels in values.yaml.)
  • The case where users do not want to explicitly pin GPU product labels (Currently, it is mandatory to pin this by gpuModels in values.yaml.)

Expected behavior

The chart should allow users to provide generic affinity block via values.yaml, mapped directly to Deployment's spec.template.spec.affinity. This would make it possible to specify podAffinity, podAntiAffinity, and nodeAffinity that is not limited to the one pinning GPU product labels.

Alternatives

No response

Additional context

No response

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

Fix Plan

To support configuring affinity for Deployment/Pod in the Helm Chart, we need to make the following changes:

  • Add a new field to values.yaml to accept the affinity block
  • Update the Deployment template to use the affinity block from values.yaml

Example Code

# values.yaml
affinity: {}
# templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "chart-helm.fullname" . }}
spec:
  template:
    spec:
      affinity: {{ toYaml .Values.affinity | indent 6 }}

Verification

To verify the fix, update values.yaml with a sample affinity block and deploy the chart. The resulting Deployment should have the specified affinity block.

# values.yaml
affinity:
  podAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
    - weight: 1
      podAffinityTerm:
        topologyKey: kubernetes.io/hostname
        labelSelector:
          matchLabels:
            app: example

Extra Tips

  • Make sure to document the new affinity field in values.yaml and provide examples of how to use it.
  • Consider adding validation to ensure that the affinity block is valid and properly formatted.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The chart should allow users to provide generic affinity block via values.yaml, mapped directly to Deployment's spec.template.spec.affinity. This would make it possible to specify podAffinity, podAntiAffinity, and nodeAffinity that is not limited to the one pinning GPU product labels.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING