refactor(vllm): restructure vllm role directory and add initial skeleton
This commit is contained in:
parent
2340e4e90f
commit
eebf9e6b6c
7 changed files with 156 additions and 0 deletions
48
roles/vllm/README.md
Normal file
48
roles/vllm/README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# vLLM
|
||||
|
||||
Installs vLLM via Helm for GPU-enabled inference workloads.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Kubernetes cluster with NVIDIA GPU workers
|
||||
- NVIDIA device plugin deployed
|
||||
- NGC API key for downloading models (stored in secret `vllm-ngc-secret`)
|
||||
|
||||
## Role Variables
|
||||
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `vllm_chart_version` | `0.1.0` | vLLM Helm chart version |
|
||||
| `vllm_namespace` | `vllm-system` | Kubernetes namespace |
|
||||
| `vllm_num_replicas` | `2` | Number of replicas for HA |
|
||||
| `vllm_image.repository` | `vllm/vllm-openai` | Container image repository |
|
||||
| `vllm_image.tag` | `latest` | Container image tag |
|
||||
| `vllm_image.pull_policy` | `IfNotPresent` | Image pull policy |
|
||||
| `vllm_resources.limits.nvidia.com/gpu` | `1` | GPU limit per pod |
|
||||
| `vllm_resources.requests.nvidia.com/gpu` | `1` | GPU request per pod |
|
||||
| `vllm_env` | `[]` | Environment variables (e.g., NGC_API_KEY) |
|
||||
| `vllm_extra_args` | `[]` | Additional CLI arguments |
|
||||
| `vllm_kubeconfig` | `/home/{{ ansible_user }}/.kube/config` | Path to kubeconfig |
|
||||
|
||||
## Example Playbook
|
||||
|
||||
```yaml
|
||||
- hosts: k8s_manager
|
||||
become: false
|
||||
roles:
|
||||
- vllm
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Create secret with NGC API key:
|
||||
```bash
|
||||
kubectl create secret generic vllm-ngc-secret \
|
||||
--from-literal=api-key=your-ngc-api-key \
|
||||
-n vllm-system
|
||||
```
|
||||
|
||||
- Ensure GPU workers are labeled:
|
||||
```bash
|
||||
kubectl label nodes <node> nvidia.com/gpu.present=true
|
||||
```
|
||||
28
roles/vllm/defaults/main.yml
Normal file
28
roles/vllm/defaults/main.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
vllm_chart_version: "0.1.0"
|
||||
vllm_namespace: vllm-system
|
||||
|
||||
vllm_deployment_mode: "distributed"
|
||||
vllm_num_replicas: 2
|
||||
|
||||
vllm_image:
|
||||
repository: "vllm/vllm-openai"
|
||||
tag: "latest"
|
||||
pull_policy: "IfNotPresent"
|
||||
|
||||
vllm_resources:
|
||||
limits:
|
||||
nvidia.com/gpu: "1"
|
||||
requests:
|
||||
nvidia.com/gpu: "1"
|
||||
|
||||
vllm_env:
|
||||
- name: "NGC_API_KEY"
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: "vllm-ngc-secret"
|
||||
key: "api-key"
|
||||
|
||||
vllm_extra_args: []
|
||||
|
||||
vllm_kubeconfig: "/home/{{ ansible_user }}/.kube/config"
|
||||
12
roles/vllm/meta/main.yml
Normal file
12
roles/vllm/meta/main.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
galaxy_info:
|
||||
role_name: vllm
|
||||
author: ops
|
||||
description: Installs vLLM via Helm for GPU-enabled inference workloads
|
||||
license: MIT
|
||||
min_ansible_version: "2.14"
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- "9"
|
||||
dependencies: []
|
||||
36
roles/vllm/tasks/deploy.yml
Normal file
36
roles/vllm/tasks/deploy.yml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
- name: Helm | Add vLLM chart repository
|
||||
ansible.builtin.command: helm repo add vllm https://vllm-project.github.io/charts
|
||||
environment:
|
||||
KUBECONFIG: "{{ vllm_kubeconfig }}"
|
||||
PATH: "/usr/local/bin:/usr/bin:/bin"
|
||||
register: _helm_repo_add
|
||||
changed_when: "'already exists' not in _helm_repo_add.stdout"
|
||||
failed_when: _helm_repo_add.rc != 0 and 'already exists' not in _helm_repo_add.stdout
|
||||
|
||||
- name: Helm | Update chart repositories
|
||||
ansible.builtin.command: helm repo update
|
||||
environment:
|
||||
KUBECONFIG: "{{ vllm_kubeconfig }}"
|
||||
PATH: "/usr/local/bin:/usr/bin:/bin"
|
||||
changed_when: false
|
||||
|
||||
- name: vLLM | Render values
|
||||
ansible.builtin.template:
|
||||
src: vllm-values.yml.j2
|
||||
dest: /tmp/vllm-values.yml
|
||||
mode: "0600"
|
||||
|
||||
- name: vLLM | Install or upgrade
|
||||
ansible.builtin.command: >
|
||||
helm upgrade --install vllm vllm/vllm
|
||||
--namespace {{ vllm_namespace }}
|
||||
--version {{ vllm_chart_version }}
|
||||
--values /tmp/vllm-values.yml
|
||||
--timeout 15m0s
|
||||
--wait
|
||||
environment:
|
||||
KUBECONFIG: "{{ vllm_kubeconfig }}"
|
||||
PATH: "/usr/local/bin:/usr/bin:/bin"
|
||||
register: _helm_install
|
||||
changed_when: "'STATUS: deployed' in _helm_install.stdout or 'has been upgraded' in _helm_install.stdout"
|
||||
6
roles/vllm/tasks/main.yml
Normal file
6
roles/vllm/tasks/main.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Create vLLM namespace
|
||||
ansible.builtin.include_tasks: namespace.yml
|
||||
|
||||
- name: Deploy vLLM via Helm
|
||||
ansible.builtin.include_tasks: deploy.yml
|
||||
10
roles/vllm/tasks/namespace.yml
Normal file
10
roles/vllm/tasks/namespace.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Create namespace
|
||||
ansible.builtin.kubectl:
|
||||
name: "{{ vllm_namespace }}"
|
||||
api_version: "v1"
|
||||
kind: "Namespace"
|
||||
state: "present"
|
||||
environment:
|
||||
KUBECONFIG: "{{ vllm_kubeconfig }}"
|
||||
PATH: "/usr/local/bin:/usr/bin:/bin"
|
||||
16
roles/vllm/templates/vllm-values.yml.j2
Normal file
16
roles/vllm/templates/vllm-values.yml.j2
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
replicaCount: {{ vllm_num_replicas }}
|
||||
|
||||
image:
|
||||
repository: {{ vllm_image.repository }}
|
||||
tag: {{ vllm_image.tag }}
|
||||
pullPolicy: {{ vllm_image.pull_policy }}
|
||||
|
||||
resources:
|
||||
limits:
|
||||
nvidia.com/gpu: {{ vllm_resources.limits.nvidia.com/gpu | default('1') }}
|
||||
requests:
|
||||
nvidia.com/gpu: {{ vllm_resources.requests.nvidia.com/gpu | default('1') }}
|
||||
|
||||
env: {{ vllm_env | default([]) | to_json }}
|
||||
|
||||
extraArgs: {{ vllm_extra_args | default([]) | to_json }}
|
||||
Loading…
Reference in a new issue