Skip to content

Commit b588994

Browse files
authored
ci: add release pipeline and getting-started doc (#5)
* docs: todo Signed-off-by: imeoer <[email protected]> * ci: add release pipeline and getting-started doc Signed-off-by: imeoer <[email protected]> --------- Signed-off-by: imeoer <[email protected]>
1 parent 001decf commit b588994

File tree

8 files changed

+208
-41
lines changed

8 files changed

+208
-41
lines changed

.github/workflows/e2e.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ jobs:
1818
- name: Checkout code
1919
uses: actions/checkout@v4
2020

21-
- name: Cache Go modules
22-
uses: actions/cache@v4
23-
with:
24-
path: |
25-
~/.cache/go-build
26-
~/go/pkg/mod
27-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28-
restore-keys: |
29-
${{ runner.os }}-go-
30-
3121
- name: Cache Docker layers
3222
uses: actions/cache@v4
3323
with:
@@ -36,19 +26,14 @@ jobs:
3626
restore-keys: |
3727
${{ runner.os }}-docker-buildx-
3828
39-
- name: Set up QEMU
40-
uses: docker/setup-qemu-action@v3
41-
4229
- name: Set up Docker Buildx
4330
uses: docker/setup-buildx-action@v3
4431

4532
- name: Build Docker Image
4633
uses: docker/build-push-action@v5
4734
with:
4835
context: .
49-
file: build/Dockerfile.test
50-
build-args: |
51-
HOME=${{ env.HOME }}
36+
file: ./build/Dockerfile
5237
tags: model-csi-driver:latest
5338
load: true
5439
push: false
@@ -74,10 +59,6 @@ jobs:
7459
run: |
7560
kind load docker-image model-csi-driver:latest
7661
77-
- name: Load docker image into kind
78-
run: |
79-
kind load docker-image model-csi-driver:latest
80-
8162
- name: Install Helm
8263
run: |
8364
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
@@ -90,6 +71,7 @@ jobs:
9071
9172
- name: Deploy model-csi-driver chart
9273
run: |
74+
sed -i "s/VERSION/0.1.0/g" charts/model-csi-driver/Chart.yaml
9375
helm upgrade --install model-csi-driver ./charts/model-csi-driver --namespace model-csi --create-namespace
9476
9577
- name: Wait for model-csi-driver pods to be ready

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
env:
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}
17+
CHART_NAME: model-csi-driver
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Cache Docker layers
23+
uses: actions/cache@v4
24+
with:
25+
path: /tmp/.buildx-cache
26+
key: ${{ runner.os }}-docker-buildx-${{ github.sha }}
27+
restore-keys: |
28+
${{ runner.os }}-docker-buildx-
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Extract tag name (version)
34+
id: extract_tag
35+
run: echo "tag=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
36+
37+
- name: Login to GitHub Container Registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Build and push Docker image
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
file: ./build/Dockerfile
49+
push: true
50+
platforms: linux/amd64,linux/arm64
51+
tags: |
52+
ghcr.io/${{ github.repository }}:${{ steps.extract_tag.outputs.tag }}
53+
ghcr.io/${{ github.repository }}:latest
54+
cache-from: type=local,src=/tmp/.buildx-cache
55+
cache-to: type=local,dest=/tmp/.buildx-cache-new
56+
57+
- name: Move Docker Build Cache
58+
run: |
59+
rm -rf /tmp/.buildx-cache
60+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true
61+
62+
- name: Install Helm
63+
run: |
64+
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
65+
66+
- name: Update chart version
67+
run: |
68+
TAG=$(echo ${{ steps.extract_tag.outputs.tag }} | sed 's/^v//')
69+
sed -i "s/VERSION/${TAG}/g" charts/${CHART_NAME}/Chart.yaml
70+
71+
- name: Helm registry login
72+
run: |
73+
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin
74+
75+
- name: Helm package chart
76+
run: |
77+
helm package charts/${CHART_NAME} --destination .
78+
79+
- name: Helm push chart to GHCR
80+
run: |
81+
CHART_VERSION=$(yq e '.version' charts/${CHART_NAME}/Chart.yaml)
82+
CHART_PKG=${CHART_NAME}-${CHART_VERSION}.tgz
83+
helm push $CHART_PKG oci://ghcr.io/${{ github.repository_owner }}/charts

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Model CSI Driver
22

3-
**Status**: 🚧 This project is actively developed, the CI setup and documentation are still in progress.
4-
53
Model CSI Driver is a Kubernetes CSI driver for serving OCI model artifacts, which are bundled based on [Model Spec](https://github.com/modelpack/model-spec).
64

5+
## Documentation
6+
7+
You can find the full documentation on the [getting started](./docs/getting-started.md).
8+
79
## Copyright
810

911
Copyright © contributors to ModelPack, established as ModelPack a Series of LF Projects, LLC.

build/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM --platform=$BUILDPLATFORM golang:1.24 AS builder
4+
ARG TARGETOS
5+
ARG TARGETARCH
6+
WORKDIR /app
7+
COPY . .
8+
RUN make -e GOARCH=${TARGETARCH} release
9+
10+
FROM ubuntu:24.04
11+
COPY --from=builder /app/model-csi-driver /usr/bin/model-csi-driver
12+
ENTRYPOINT ["/usr/bin/model-csi-driver"]

build/Dockerfile.test

Lines changed: 0 additions & 11 deletions
This file was deleted.

charts/model-csi-driver/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.1.0
18+
version: "VERSION"
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "0.1.0"
24+
appVersion: "VERSION"

charts/model-csi-driver/values.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ config:
99
# must be writable and have enough disk space
1010
rootDir: /var/lib/model-csi
1111
registryAuths:
12-
# Registry host:port
13-
example.com:
14-
# Based64 encoded username:password
15-
auth: dXNlcm5hbWU6cGFzc3dvcmQ=
16-
# Registry server scheme, http or https
17-
serverscheme: https
12+
# registry.example.com:
13+
# auth: dXNlcm5hbWU6cGFzc3dvcmQ=
14+
# serverscheme: https
1815

1916
namespace: model-csi
2017

docs/getting-started.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Getting Started with Model CSI Driver
2+
3+
Model CSI Driver is a Kubernetes CSI driver for serving OCI model artifacts, which are bundled based on [Model Spec](https://github.com/modelpack/model-spec). This guide will help you deploy and use the Model CSI Driver in your Kubernetes cluster.
4+
5+
## Overview
6+
7+
The Model CSI Driver simplifies and accelerates model deployment in Kubernetes by:
8+
9+
- Seamlessly mount model artifacts as volumes into pod
10+
- Compatible with older Kubernetes versions
11+
- Natively supports P2P-accelerated distribution
12+
13+
## Prerequisites
14+
15+
Before getting started, ensure you have:
16+
17+
- `kubectl` configured to access your Kubernetes cluster
18+
- Helm v3.x (recommended for installation)
19+
20+
## Installation
21+
22+
### Helm Installation
23+
24+
1. Create custom configuration:
25+
26+
```yaml
27+
# values-custom.yaml
28+
config:
29+
# Root working directory for model storage and metadata,
30+
# must be writable and have enough disk space
31+
rootDir: /var/lib/model-csi
32+
# Configuration for private registry auth
33+
registryAuths:
34+
# Registry host:port
35+
registry.example.com:
36+
# Based64 encoded username:password
37+
auth: dXNlcm5hbWU6cGFzc3dvcmQ=
38+
# Registry server scheme, http or https
39+
serverscheme: https
40+
image:
41+
# Model csi driver daemonset image
42+
repository: ghcr.io/modelpack/model-csi-driver
43+
pullPolicy: IfNotPresent
44+
tag: latest
45+
```
46+
47+
2. Install the driver using Helm:
48+
```bash
49+
helm upgrade --install model-csi-driver \
50+
oci://ghcr.io/modelpack/charts/model-csi-driver \
51+
--namespace model-csi \
52+
--create-namespace \
53+
-f values-custom.yaml
54+
```
55+
56+
3. Verify the installation:
57+
```bash
58+
kubectl get pods -n model-csi
59+
```
60+
61+
## Basic Usage
62+
63+
### Create Model Artifact with modctl
64+
65+
Follow the [guide](https://github.com/modelpack/modctl/blob/main/docs/getting-started.md) to build and push a model artifact to an OCI distribution-compatible registry.
66+
67+
### Create a Pod with Model Volume
68+
69+
The Model CSI Driver uses inline volume directly in pod spec, here's a basic example:
70+
71+
```yaml
72+
apiVersion: v1
73+
kind: Pod
74+
metadata:
75+
name: model-inference-pod
76+
spec:
77+
containers:
78+
- name: inference-server
79+
image: ubuntu:24.04
80+
command: ["sleep", "infinity"]
81+
volumeMounts:
82+
- name: model-volume
83+
mountPath: /model
84+
readOnly: true
85+
volumes:
86+
- name: model-volume
87+
csi:
88+
driver: model.csi.modelpack.org
89+
volumeAttributes:
90+
modelRef: "registry.example.com/models/qwen3-0.6b:latest"
91+
```
92+
93+
## Troubleshooting
94+
95+
### Pod stuck in Pending or ContainerCreating
96+
```bash
97+
# Describe a pod with issues
98+
kubectl describe pod <pod-name>
99+
100+
# Check model csi driver logs
101+
kubectl logs -c model-csi-driver -n model-csi
102+
```

0 commit comments

Comments
 (0)