|
| 1 | +# Dynamic LORA Adapter Sidecar for vLLM |
| 2 | + |
| 3 | +This directory contains a configmap containing lora adapters configurations and script for a sidecar container to dynamically manage LORA adapters for a vLLM server running in the same Kubernetes pod by reconciling it with a configmap containing lora adapters. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The sidecar continuously monitors a ConfigMap mounted as a YAML configuration file. This file defines the desired state of LORA adapters, including: |
| 8 | + |
| 9 | +- **Adapter ID:** Unique identifier for the adapter. |
| 10 | +- **Source:** Path to the adapter's source files. |
| 11 | +- **Base Model:** The base model to which the adapter should be applied. |
| 12 | +- **toRemove:** (Optional) Indicates whether the adapter should be unloaded. |
| 13 | + |
| 14 | +The sidecar uses the vLLM server's API to load or unload adapters based on the configuration. It also periodically reconciles the registered adapters on the vLLM server with the desired state defined in the ConfigMap, ensuring consistency. |
| 15 | + |
| 16 | +## Features |
| 17 | + |
| 18 | +- **Dynamic Loading and Unloading:** Load and unload LORA adapters without restarting the vLLM server. |
| 19 | +- **Continuous Reconciliation:** Ensures the vLLM server's state matches the desired configuration. |
| 20 | +- **ConfigMap Integration:** Leverages Kubernetes ConfigMaps for easy configuration management. |
| 21 | +- **Easy Deployment:** Provides a sample deployment YAML for quick setup. |
| 22 | + |
| 23 | +## Repository Contents |
| 24 | + |
| 25 | +- **`sidecar.py`:** Python script for the sidecar container. |
| 26 | +- **`Dockerfile`:** Dockerfile to build the sidecar image. |
| 27 | +- **`configmap.yaml`:** Example ConfigMap YAML file. |
| 28 | +- **`deployment.yaml`:** Example Kubernetes deployment YAML. |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +1. **Build the Docker Image:** |
| 33 | + ```bash |
| 34 | + docker build -t <your-image-name> . |
| 35 | +2. **Create a configmap:** |
| 36 | + ```bash |
| 37 | + kubectl create configmap name-of-your-configmap --from-file=your-file.yaml |
| 38 | +3. **Mount the configmap and configure sidecar in your pod** |
| 39 | + ![example deployment][deployment] |
| 40 | +
|
| 41 | +[deployment]: deployment.yaml |
0 commit comments