first backup of charts

This commit is contained in:
Ivan087
2025-09-23 10:01:17 +08:00
commit cbfc0104a6
170 changed files with 17788 additions and 0 deletions

View File

@ -0,0 +1,17 @@
apiVersion: v1
appVersion: 6.0.3
description: Helm for jupyter single server with pyspark support
home: https://jupyter.org
icon: https://jupyter.org/assets/main-logo.svg
keywords:
- jupyter
- notebook
- spark
maintainers:
- email: cgiraldo@gradiant.org
name: cgiraldo
name: jupyter
sources:
- https://github.com/gradiant/charts
- https://github.com/astrobounce/helm-jupyter
version: 0.1.6

34
jupyter/jupyter/README.md Normal file
View File

@ -0,0 +1,34 @@
jupyter
=======
Helm for jupyter single server with pyspark support.
For jupyterhub chart see [zero-to-jupyterhub](https://zero-to-jupyterhub.readthedocs.io/en/latest/).
Current chart version is `0.1.0`
Source code can be found [here]((https://github.com/gradiant/charts/charts/jupyter)
## Chart Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"gradiant/jupyter"` | |
| image.tag | string | `"6.0.1"` | |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0] | string | `"jupyter.127-0-0-1.nip"` | |
| ingress.path | string | `"/"` | |
| ingress.tls | list | `[]` | |
| lab | bool | `true` | |
| nodeSelector | object | `{}` | |
| persistence.accessMode | string | `"ReadWriteOnce"` | |
| persistence.enabled | bool | `true` | |
| persistence.size | string | `"50Gi"` | |
| persistence.storageClass | string | `nil` | |
| resources | object | `{}` | |
| service.externalPort | int | `8888` | |
| service.nodePort.http | string | `nil` | |
| service.type | string | `"ClusterIP"` | |
| tolerations | list | `[]` | |

View File

@ -0,0 +1,23 @@
1. Get access token from jupyter server log:
kubectl logs -f -n {{ .Release.Namespace }} svc/{{ include "jupyter.fullname" . }}
1. Create a port-forward to the jupyter:
kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "jupyter.fullname" . }} 8888:{{ .Values.service.externalPort }}
Then open the ui in your browser and use the access token:
open http://localhost:88888
If you set up your own password, remember to restart jupyter server to update the configuration.
File -> Shut Down
{{- if .Values.ingress.enabled }}
Ingress is enabled:
{{- range .Values.ingress.tls }}
{{- range .hosts }}
open https://{{ . }}
{{- end }}
{{- end }}
{{- range .Values.ingress.hosts }}
open http://{{ . }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "jupyter.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).
*/}}
{{- define "jupyter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{/*
Standard Labels from Helm documentation https://helm.sh/docs/chart_best_practices/#labels-and-annotations
*/}}
{{- define "jupyter.labels" -}}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/part-of: {{ .Chart.Name }}
{{- end -}}

View File

@ -0,0 +1,36 @@
{{- if .Values.gitNotebooks }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "jupyter.fullname" . }}-git-notebooks
labels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
{{- include "jupyter.labels" . | nindent 4 }}
data:
git-notebooks.sh: |-
#!/bin/sh
set -x
cd /home/jovyan
{{- if .Values.gitNotebooks.secretName }}
cp -r /tmp/.ssh /root/
chmod 600 /root/.ssh/*
{{- else }}
mkdir /root/.ssh
{{- end }}
echo "Loading notebooks from git repo"
{{- range .Values.gitNotebooks.repos }}
if [ ! -d "/home/jovyan/{{ .name }}" ]
then
echo "Cloning {{ .name }} notebook repository"
{{- if or (hasPrefix "git" .repo) (hasPrefix "ssh" .repo) }}
ssh-keyscan {{ .repo | regexFind "@([a-zA-Z0-9.]*)" | replace "@" "" }} >> ~/.ssh/known_hosts
{{- end }}
git clone {{ .repo }} {{ .name }}
else
echo "{{ .name }} notebook repository already cloned"
fi
{{- end }}
# exit code 0 to continue deployment even if git clone fails
exit 0
{{- end }}

View File

@ -0,0 +1,39 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "jupyter.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
{{- include "jupyter.labels" . | nindent 4 }}
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: web
{{- end }}
{{- end }}

View File

@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "jupyter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
{{- include "jupyter.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
selector:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
ports:
- name: web
protocol: TCP
port: {{ .Values.service.externalPort | default 8888 }}
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort.http))) }}
nodePort: {{ .Values.service.nodePort.http }}
{{- end }}
targetPort: 8888

View File

@ -0,0 +1,118 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "jupyter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
{{- include "jupyter.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
serviceName: {{ include "jupyter.fullname" . }}
replicas: 1
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "jupyter.name" . }}
{{- include "jupyter.labels" . | nindent 8}}
spec:
{{- if .Values.gitNotebooks }}
initContainers:
- name: git-notebooks
image: alpine/git
command:
- /bin/bash
- /git-notebooks.sh
volumeMounts:
- name: git-notebooks
mountPath: /git-notebooks.sh
subPath: git-notebooks.sh
- name: jupyter
mountPath: /home/jovyan
{{- if .Values.gitNotebooks.secretName }}
- name: git-secret
mountPath: "/tmp/.ssh"
{{- end }}
{{- end }}
containers:
- name: jupyter
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
env:
- name: JUPYTER_ENABLE_LAB
value: "{{ .Values.lab }}"
- name: JPY_USER
value: "jovyan"
args:
- start-notebook.sh
- --ip=0.0.0.0
- --user="jovyan"
ports:
- name: web
containerPort: 8888
protocol: TCP
resources:
{{ toYaml .Values.resources | indent 10 }}
readinessProbe:
httpGet:
path: /
port: 8888
initialDelaySeconds: 60
timeoutSeconds: 15
livenessProbe:
httpGet:
path: /
port: 8888
initialDelaySeconds: 60
timeoutSeconds: 15
volumeMounts:
- name: jupyter
mountPath: /home/jovyan
volumes:
{{- if .Values.gitNotebooks }}
- name: git-notebooks
configMap:
name: {{ include "jupyter.fullname" . }}-git-notebooks
{{- if .Values.gitNotebooks.secretName }}
- name: git-secret
secret:
secretName: {{ .Values.gitNotebooks.secretName }}
{{- end }}
{{- end }}
{{- if not .Values.persistence.enabled }}
- name: jupyter
emptyDir: {}
{{- 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 }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: jupyter
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: "{{ .Values.persistence.size }}"
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,64 @@
# Default values for jupyter.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
repository: gradiant/jupyter
tag: 6.0.3
pullPolicy: IfNotPresent
lab: true
#gitNotebooks:
# secretName: the name of the secret with ssh keys
# repos:
# - name: gradiant
# repo: https://github.com/Gradiant/notebooks.git
# - name: grad-git
# repo: git@github.com:Gradiant/notebooks.git
service:
type: ClusterIP
externalPort: 8888
nodePort:
http:
persistence:
enabled: true
storageClass:
accessMode: ReadWriteOnce
size: 50Gi
## Ingress configuration
## Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/
##
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- jupyter.127-0-0-1.nip.io
tls: []
# - secretName: jupyter-tls
# hosts:
# - jupyter.local
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}

55
jupyter/metadata.yaml Normal file
View File

@ -0,0 +1,55 @@
application_name: &application_name jupyter
distributed:
method: helm
release_name: *application_name
chart: jupyter
sets:
image:
repository: gradiant/jupyter
tag: 6.0.3
pullPolicy: IfNotPresent
resources:
limits:
nvidia.com/gpu: 0
nodeSelector:
resource-group: gpu_5880
service:
type: NodePort
nodePort:
http: 30888
svc:
svc_type: NodePort
protocol: http
hostname: 10.6.14.123
servicename: ~
port: 30888
url: ~
pod:
name: jupyter-
monolithic:
method: helm
release_name: *application_name
chart: jupyter
sets:
image:
repository: gradiant/jupyter
tag: 6.0.3
pullPolicy: IfNotPresent
resources:
limits:
nvidia.com/gpu: 0
nodeSelector:
resource-group: gpu_5880
service:
type: NodePort
svc:
svc_type: NodePort
protocol: http
hostname: 10.6.14.123
servicename: ~
port: 30888
url: ~
pod:
name: jupyter-