setup all initial notebooks

This commit is contained in:
Nikita Aleksandrov 2025-09-02 15:18:10 +02:00
parent e1b8a67cb1
commit 7f3e7645c7
5 changed files with 45 additions and 100 deletions

View File

@ -7,3 +7,4 @@ ipywidgets
mlflow mlflow
ollama ollama
panel panel
ray

View File

@ -1,19 +1,18 @@
--- ---
{{- /* {{- /*
Create ConfigMaps for jupyterhub singleuser pods. Create a single ConfigMap with all initialization files for the jupyterhub singleuser pod.
These ConfigMaps are mounted as volumes. This ConfigMap is mounted as a volume.
*/ -}} */ -}}
{{- range $path, $_ := .Files.Glob "files/*" }}
---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: {{ printf "%s-%s" $.Release.Name (base $path | replace "." "-" | replace "_" "-") }} name: ai-starter-kit-init-files
labels: labels:
app.kubernetes.io/managed-by: {{ $.Release.Service | quote }} app.kubernetes.io/managed-by: {{ $.Release.Service | quote }}
app.kubernetes.io/instance: {{ $.Release.Name | quote }} app.kubernetes.io/instance: {{ $.Release.Name | quote }}
helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
data: data:
{{- range $path, $bytes := .Files.Glob "files/*" }}
{{ base $path | quote }}: |- {{ base $path | quote }}: |-
{{ $.Files.Get $path | nindent 4 }} {{ $bytes | toString | nindent 4 }}
{{- end }} {{- end }}

View File

@ -37,28 +37,22 @@ jupyterhub:
pip install -r /tmp/requirements.txt pip install -r /tmp/requirements.txt
python /tmp/download_models.py python /tmp/download_models.py
# populate workspace with initial files # populate workspace with initial files
if [ ! -f /home/jovyan/welcome.ipynb ]; then for f in /tmp/*.ipynb; do
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb if [ -f "$f" ]; then
fi # Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts: volumeMounts:
- name: requirements-txt # This 'home' volume is created by the helm chart's 'homeMountPath' option.
mountPath: /tmp/requirements.txt # We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home - name: home
mountPath: /home/jovyan mountPath: /home/jovyan
subPath: jupyterhub_workspace subPath: jupyterhub_workspace
- name: "download-models-py" - name: init-files
mountPath: /tmp/download_models.py mountPath: /tmp
subPath: download_models.py
readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
readOnly: true readOnly: true
storage: storage:
@ -69,21 +63,9 @@ jupyterhub:
capacity: 20Gi capacity: 20Gi
homeMountPath: /home/jovyan homeMountPath: /home/jovyan
extraVolumes: extraVolumes:
- name: requirements-txt - name: init-files
configMap: configMap:
name: "ai-starter-kit-requirements-txt" name: "ai-starter-kit-init-files"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv # This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv: extraEnv:
HF_TOKEN: HF_TOKEN:

View File

@ -38,29 +38,22 @@ jupyterhub:
python /tmp/download_models.py python /tmp/download_models.py
# populate workspace with initial files # populate workspace with initial notebook files
if [ ! -f /home/jovyan/welcome.ipynb ]; then for f in /tmp/*.ipynb; do
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb if [ -f "$f" ]; then
fi # Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts: volumeMounts:
- name: requirements-txt # This 'home' volume is created by the helm chart's 'homeMountPath' option.
mountPath: /tmp/requirements.txt # We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home - name: home
mountPath: /home/jovyan mountPath: /home/jovyan
subPath: jupyterhub_workspace subPath: jupyterhub_workspace
- name: "download-models-py" - name: init-files
mountPath: /tmp/download_models.py mountPath: /tmp
subPath: download_models.py
readOnly: true readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
readOnly: true
storage: storage:
type: static type: static
static: static:
@ -69,21 +62,9 @@ jupyterhub:
capacity: 20Gi capacity: 20Gi
homeMountPath: /home/jovyan homeMountPath: /home/jovyan
extraVolumes: extraVolumes:
- name: requirements-txt - name: init-files
configMap: configMap:
name: "ai-starter-kit-requirements-txt" name: "ai-starter-kit-init-files"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv # This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv: extraEnv:
HF_TOKEN: HF_TOKEN:

View File

@ -37,28 +37,22 @@ jupyterhub:
pip install -r /tmp/requirements.txt pip install -r /tmp/requirements.txt
python /tmp/download_models.py python /tmp/download_models.py
# populate workspace with initial files # populate workspace with initial files
if [ ! -f /home/jovyan/welcome.ipynb ]; then for f in /tmp/*.ipynb; do
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb if [ -f "$f" ]; then
fi # Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts: volumeMounts:
- name: requirements-txt # This 'home' volume is created by the helm chart's 'homeMountPath' option.
mountPath: /tmp/requirements.txt # We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home - name: home
mountPath: /home/jovyan mountPath: /home/jovyan
subPath: jupyterhub_workspace subPath: jupyterhub_workspace
- name: "download-models-py" - name: init-files
mountPath: /tmp/download_models.py mountPath: /tmp
subPath: download_models.py
readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
readOnly: true readOnly: true
storage: storage:
@ -69,21 +63,9 @@ jupyterhub:
capacity: 20Gi capacity: 20Gi
homeMountPath: /home/jovyan homeMountPath: /home/jovyan
extraVolumes: extraVolumes:
- name: requirements-txt - name: init-files
configMap: configMap:
name: "ai-starter-kit-requirements-txt" name: "ai-starter-kit-init-files"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv # This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv: extraEnv:
HF_TOKEN: HF_TOKEN: