init ai-starter-kit

This commit is contained in:
Vlado Djerek 2025-06-26 16:45:53 +02:00
parent 0598f0762a
commit da25c29ca8
8 changed files with 198 additions and 0 deletions

4
.gitignore vendored
View File

@ -43,3 +43,7 @@ cscope.*
/bazel-*
*.pyc
# Helm chart dependecies cache
**/Chart.lock
**/charts/*.tgz

View File

@ -0,0 +1,17 @@
lint:
helm lint helm-chart/ai-starter-kit
dep_update:
helm dependency update helm-chart/ai-starter-kit
install:
helm upgrade --install ai-starter-kit helm-chart/ai-starter-kit --timeout 10m
start:
minikube start --cpus 4 --memory 8192
uninstall:
helm uninstall ai-starter-kit
destroy:
minikube delete

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,39 @@
apiVersion: v2
name: ai-starter-kit
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
dependencies:
- name: kuberay-operator
version: "1.3.0"
repository: "https://ray-project.github.io/kuberay-helm"
- name: ray-cluster
version: "1.3.0"
repository: "https://ray-project.github.io/kuberay-helm"
- name: jupyterhub
version: "9.0.16"
repository: "https://charts.bitnami.com/bitnami"
- name: mlflow
version: "4.0.4"
repository: "https://charts.bitnami.com/bitnami"

View File

@ -0,0 +1 @@
AI Starter Kit installed. Enjoy

View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ai-starter-kit.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 "ai-starter-kit.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 "ai-starter-kit.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "ai-starter-kit.labels" -}}
helm.sh/chart: {{ include "ai-starter-kit.chart" . }}
{{ include "ai-starter-kit.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "ai-starter-kit.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ai-starter-kit.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "ai-starter-kit.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ai-starter-kit.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,40 @@
jupyterhub:
nameOverride: "jupyterhub"
postgresql:
nameOverride: "jupyterhub-postgresql"
enabled: true
auth:
password: "changeme"
singleuser:
extraEnvVars:
RAY_ADDRESS: "{{ tpl .Release.Name $ }}-kuberay-head-svc:6379"
MLFLOW_TRACKING_URI: "http://{{ tpl .Release.Name $ }}-mlflow-tracking"
JUPYTERLAB_DIR: "/opt"
hub:
password: "sneakypass"
extraEnvVars:
- name: "RAY_ADDRESS"
value: "{{ tpl .Release.Name $ }}-kuberay-head-svc"
- name: "MLFLOW_TRACKING_URI"
value: "http://{{ tpl .Release.Name $ }}-mlflow-tracking"
ray-cluster:
head:
serviceType: ClusterIP
resources:
limits:
memory: "8G"
mlflow:
postgresql:
auth:
password: "changeme"
minio:
auth:
rootPassword: "somepassword"
tracking:
auth:
password: "changemeibegyou"
flaskServerSecretKey: "noneedtochangethisone"

View File

@ -0,0 +1,12 @@
!pip install ray
from ray.job_submission import JobSubmissionClient
# If using a remote cluster, replace 127.0.0.1 with the head node's IP address or set up port forwarding.
client = JobSubmissionClient()
job_id = client.submit_job(
# Entrypoint shell command to execute
entrypoint="python script.py",
# Path to the local directory that contains the script.py file
runtime_env={"working_dir": "./","excludes": ["/.cache","/.local"]}
)
print(job_id)