Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ repos:
hooks:
- id: end-of-file-fixer
files: \.(mps|json|yaml|yml|txt)$
exclude: ^datasets/.*\.(mps|json|yaml|yml|txt)$
exclude: ^(datasets|helmchart)/.*\.(mps|json|yaml|yml|txt)$
- id: trailing-whitespace
files: \.(mps|json|yaml|yml|txt)$
exclude: ^datasets/.*\.(mps|json|yaml|yml|txt)$
- id: check-builtin-literals
- id: check-executables-have-shebangs
- id: check-json
- id: check-yaml
files: \.(yaml)$
exclude: ^(helmchart)/.*\.(yaml)$
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand Down
5 changes: 5 additions & 0 deletions ci/release/update-version-cuopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ sed_runner "s/\(cuopt-sh-client==\)[0-9]\+\.[0-9]\+\.\\*/\1${PY_NEXT_SHORT_TAG}.
sed_runner 's/cuopt-server=[0-9][0-9].[0-9][0-9] cuopt-sh-client=[0-9][0-9].[0-9][0-9] python=[0-9].[0-9][0-9] cuda-version=[0-9][0-9].[0-9]/cuopt-server='${NEXT_SHORT_TAG}' cuopt-sh-client='${NEXT_SHORT_TAG}' python=3.12 cuda-version=12.8/g' README.md
sed_runner 's|cuopt:[0-9]\{2\}\.[0-9]\{1,2\}\.[0-9]\+\(-cuda12\.8-\)\(py[0-9]\+\)|cuopt:'"${DOCKER_TAG}"'\1\2|g' README.md

# Update Helm chart files
sed_runner 's/\(tag: "\)[0-9][0-9]\.[0-9]\+\.[0-9]\+\(-cuda12\.8-py3\.12"\)/\1'${DOCKER_TAG}'\2/g' helmchart/cuopt-server/values.yaml
sed_runner 's/\(appVersion: \)[0-9][0-9]\.[0-9]\+\.[0-9]\+/\1'${DOCKER_TAG}'/g' helmchart/cuopt-server/Chart.yaml
sed_runner 's/\(version: \)[0-9][0-9]\.[0-9]\+\.[0-9]\+/\1'${DOCKER_TAG}'/g' helmchart/cuopt-server/Chart.yaml

DEPENDENCIES=(
libcuopt
cuopt
Expand Down
17 changes: 17 additions & 0 deletions helmchart/cuopt-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
appVersion: 25.8.0
description: A Helm chart for NVIDIA cuOpt Server with GPU support
home: https://docs.nvidia.com/cuopt/user-guide/latest/resources.html
keywords:
- nvidia
- cuopt
- optimization
- gpu
maintainers:
- email: cuopt@nvidia.com
name: cuopt-maintainer
name: cuopt-server
sources:
- https://docs.nvidia.com/cuopt/user-guide/latest/resources.html
type: application
version: 25.8.0
66 changes: 66 additions & 0 deletions helmchart/cuopt-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# cuOpt Server Helm Chart

This Helm chart deploys the NVIDIA cuOpt Server with GPU support on Kubernetes.

## Prerequisites

- Kubernetes cluster with GPU nodes
- NVIDIA device plugin installed on the cluster
- NVIDIA GPU Operator (recommended) or manual GPU driver installation
- Helm 3.x installed

## Selecting the Container Image

- To use a specific version of the cuOpt server, update the `image.tag` field in `values.yaml`.
- If the desired version is not available as a release, you may use a nightly image.
- All available container tags can be found on [Docker Hub](https://hub.docker.com/r/nvidia/cuopt/tags).
## Installation

### 1. Add the chart repository (if publishing to a repository)
```bash
helm repo add cuopt-server https://your-repo-url
helm repo update
```

### 2. Install the chart
```bash
# Install with default values
helm install cuopt-server ./cuopt-server

# Install with custom values
helm install cuopt-server ./cuopt-server -f custom-values.yaml

# Install with inline overrides
helm install cuopt-server ./cuopt-server \
--set resources.requests.nvidia.com/gpu=2 \
--set resources.limits.nvidia.com/gpu=2
```

## Usage

### Port Forwarding (for ClusterIP service)
```bash
kubectl port-forward service/cuopt-server 5000:5000
```

### Accessing the Service
Once deployed, you can access the cuOpt server API at:
- `http://localhost:5000` (with port forwarding)
- Or through the service endpoint within the cluster

### Testing the Deployment
```bash
# Check pod status
kubectl get pods -l app.kubernetes.io/name=cuopt-server

# View logs
kubectl logs -l app.kubernetes.io/name=cuopt-server

# Check GPU allocation
kubectl describe pod -l app.kubernetes.io/name=cuopt-server
```

## Uninstall

```bash
helm uninstall cuopt-server
34 changes: 34 additions & 0 deletions helmchart/cuopt-server/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cuopt-server.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cuopt-server.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cuopt-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "{{ include "cuopt-server.selectorLabels" . }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:5000 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 5000:$CONTAINER_PORT
{{- end }}

2. To check the status of your cuOpt server deployment:
kubectl get pods -l "{{ include "cuopt-server.selectorLabels" . }}"

3. To view the logs:
kubectl logs -l "{{ include "cuopt-server.selectorLabels" . }}"

4. Important Notes:
- This deployment requires GPU nodes in your cluster
- Make sure your cluster has the NVIDIA device plugin installed
- The server will be running the command: python -m cuopt_server.cuopt_service
- Port 5000 is exposed for the cuOpt service API
62 changes: 62 additions & 0 deletions helmchart/cuopt-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cuopt-server.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cuopt-server.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cuopt-server.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cuopt-server.labels" -}}
helm.sh/chart: {{ include "cuopt-server.chart" . }}
{{ include "cuopt-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cuopt-server.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cuopt-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cuopt-server.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cuopt-server.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
88 changes: 88 additions & 0 deletions helmchart/cuopt-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cuopt-server.fullname" . }}
labels:
{{- include "cuopt-server.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "cuopt-server.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "cuopt-server.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "cuopt-server.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.command }}
command:
{{- toYaml .Values.command | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /v2/health/live
port: http
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /v2/health/ready
port: http
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.env }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- name: storage
mountPath: /data
{{- end }}
{{- if .Values.persistence.enabled }}
volumes:
- name: storage
persistentVolumeClaim:
claimName: {{ include "cuopt-server.fullname" . }}-pvc
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
59 changes: 59 additions & 0 deletions helmchart/cuopt-server/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "cuopt-server.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class")) }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "cuopt-server.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions helmchart/cuopt-server/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "cuopt-server.fullname" . }}
labels:
{{- include "cuopt-server.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "cuopt-server.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions helmchart/cuopt-server/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "cuopt-server.serviceAccountName" . }}
labels:
{{- include "cuopt-server.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading