Skip to content

Commit 01804ae

Browse files
committed
jupyter single server
1 parent 1fadc8f commit 01804ae

File tree

8 files changed

+310
-0
lines changed

8 files changed

+310
-0
lines changed

charts/jupyter/Chart.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "jupyter"
2+
version: "0.1.0"
3+
description: "Helm for jupyter single server with pyspark support"
4+
keywords:
5+
- jupyter
6+
- notebook
7+
- spark
8+
home: "https://jupyter.org"
9+
icon: https://jupyter.org/assets/main-logo.svg
10+
sources:
11+
- "https://github.com/gradiant/charts"
12+
- "https://github.com/astrobounce/helm-jupyter"
13+
maintainers:
14+
- name: "cgiraldo"
15+
16+
apiVersion: v1
17+
appVersion: "6.0.1"

charts/jupyter/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
jupyter
2+
=======
3+
Helm for jupyter single server with pyspark support.
4+
For jupyterhub chart see [zero-to-jupyterhub](https://zero-to-jupyterhub.readthedocs.io/en/latest/).
5+
6+
Current chart version is `0.1.0`
7+
8+
Source code can be found [here]((https://github.com/gradiant/charts/charts/jupyter)
9+
10+
11+
## Chart Values
12+
13+
| Key | Type | Default | Description |
14+
|-----|------|---------|-------------|
15+
| affinity | object | `{}` | |
16+
| image.pullPolicy | string | `"IfNotPresent"` | |
17+
| image.repository | string | `"gradiant/jupyter"` | |
18+
| image.tag | string | `"6.0.1"` | |
19+
| ingress.annotations | object | `{}` | |
20+
| ingress.enabled | bool | `false` | |
21+
| ingress.hosts[0] | string | `"jupyter.127-0-0-1.nip"` | |
22+
| ingress.path | string | `"/"` | |
23+
| ingress.tls | list | `[]` | |
24+
| lab | bool | `true` | |
25+
| nodeSelector | object | `{}` | |
26+
| persistence.accessMode | string | `"ReadWriteOnce"` | |
27+
| persistence.enabled | bool | `true` | |
28+
| persistence.size | string | `"50Gi"` | |
29+
| persistence.storageClass | string | `nil` | |
30+
| resources | object | `{}` | |
31+
| service.externalPort | int | `8888` | |
32+
| service.nodePort.http | string | `nil` | |
33+
| service.type | string | `"ClusterIP"` | |
34+
| tolerations | list | `[]` | |

charts/jupyter/templates/NOTES.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
1. Get access token from jupyter server log:
2+
kubectl logs -f -n {{ .Release.Namespace }} svc/{{ include "jupyter.fullname" . }}
3+
4+
1. Create a port-forward to the jupyter:
5+
kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "jupyter.fullname" . }} 8888:{{ .Values.service.externalPort }}
6+
7+
Then open the ui in your browser and use the access token:
8+
open http://localhost:88888
9+
10+
If you set up your own password, remember to restart jupyter server to update the configuration.
11+
File -> Shut Down
12+
13+
{{- if .Values.ingress.enabled }}
14+
Ingress is enabled:
15+
{{- range .Values.ingress.tls }}
16+
{{- range .hosts }}
17+
open https://{{ . }}
18+
{{- end }}
19+
{{- end }}
20+
{{- range .Values.ingress.hosts }}
21+
open http://{{ . }}
22+
{{- end }}
23+
{{- end }}

charts/jupyter/templates/_helpers.tpl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "jupyter.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
*/}}
13+
{{- define "jupyter.fullname" -}}
14+
{{- if .Values.fullnameOverride -}}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
16+
{{- else -}}
17+
{{- $name := default .Chart.Name .Values.nameOverride -}}
18+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
19+
{{- end -}}
20+
{{- end -}}
21+
22+
{{/*
23+
Standard Labels from Helm documentation https://helm.sh/docs/chart_best_practices/#labels-and-annotations
24+
*/}}
25+
26+
{{- define "jupyter.labels" -}}
27+
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28+
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
29+
app.kubernetes.io/instance: {{ .Release.Name | quote }}
30+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
31+
app.kubernetes.io/part-of: {{ .Chart.Name }}
32+
{{- end -}}

charts/jupyter/templates/ingress.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "jupyter.fullname" . -}}
3+
{{- $servicePort := .Values.service.port -}}
4+
{{- $ingressPath := .Values.ingress.path -}}
5+
apiVersion: extensions/v1beta1
6+
kind: Ingress
7+
metadata:
8+
name: {{ $fullName }}
9+
labels:
10+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
11+
{{- include "jupyter.labels" . | nindent 4 }}
12+
{{- if .Values.ingress.labels }}
13+
{{ toYaml .Values.ingress.labels | indent 4 }}
14+
{{- end }}
15+
{{- with .Values.ingress.annotations }}
16+
annotations:
17+
{{ toYaml . | indent 4 }}
18+
{{- end }}
19+
spec:
20+
{{- if .Values.ingress.tls }}
21+
tls:
22+
{{- range .Values.ingress.tls }}
23+
- hosts:
24+
{{- range .hosts }}
25+
- {{ . }}
26+
{{- end }}
27+
secretName: {{ .secretName }}
28+
{{- end }}
29+
{{- end }}
30+
rules:
31+
{{- range .Values.ingress.hosts }}
32+
- host: {{ . }}
33+
http:
34+
paths:
35+
- path: {{ $ingressPath }}
36+
backend:
37+
serviceName: {{ $fullName }}
38+
servicePort: {{ $servicePort }}
39+
{{- end }}
40+
{{- end }}

charts/jupyter/templates/service.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "jupyter.fullname" . }}
5+
labels:
6+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
7+
{{- include "jupyter.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
selector:
11+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
12+
app.kubernetes.io/instance: {{ .Release.Name }}
13+
ports:
14+
- name: web
15+
protocol: TCP
16+
port: {{ .Values.service.externalPort | default 8888 }}
17+
targetPort: http
18+
name: http
19+
{{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort.http))) }}
20+
nodePort: {{ .Values.service.nodePort.http }}
21+
{{- end }}
22+
targetPort: 8888
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: apps/v1
2+
kind: StatefulSet
3+
metadata:
4+
name: {{ include "jupyter.fullname" . }}
5+
labels:
6+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
7+
{{- include "jupyter.labels" . | nindent 4 }}
8+
spec:
9+
selector:
10+
matchLabels:
11+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
12+
{{- include "jupyter.labels" . | nindent 6 }}
13+
serviceName: {{ include "jupyter.fullname" . }}
14+
replicas: 1
15+
template:
16+
metadata:
17+
labels:
18+
app.kubernetes.io/name: {{ include "jupyter.name" . }}
19+
{{- include "jupyter.labels" . | nindent 8}}
20+
spec:
21+
containers:
22+
- name: jupyter
23+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
24+
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
25+
env:
26+
- name: JUPYTER_ENABLE_LAB
27+
value: "{{ .Values.lab }}"
28+
args:
29+
- --ip=0.0.0.0
30+
ports:
31+
- name: web
32+
containerPort: 8888
33+
protocol: TCP
34+
resources:
35+
{{ toYaml .Values.resources | indent 10 }}
36+
readinessProbe:
37+
httpGet:
38+
path: /
39+
port: 8888
40+
initialDelaySeconds: 60
41+
timeoutSeconds: 15
42+
livenessProbe:
43+
httpGet:
44+
path: /
45+
port: 8888
46+
initialDelaySeconds: 60
47+
timeoutSeconds: 15
48+
volumeMounts:
49+
- name: jupyter
50+
mountPath: /home/jovyan
51+
volumes:
52+
{{- if not .Values.persistence.enabled }}
53+
- name: jupyter
54+
emptyDir: {}
55+
{{- end }}
56+
{{- with .Values.nodeSelector }}
57+
nodeSelector:
58+
{{- toYaml . | nindent 8 }}
59+
{{- end }}
60+
{{- with .Values.affinity }}
61+
affinity:
62+
{{- toYaml . | nindent 8 }}
63+
{{- end }}
64+
{{- with .Values.tolerations }}
65+
tolerations:
66+
{{- toYaml . | nindent 8 }}
67+
{{- end }}
68+
{{- if .Values.persistence.enabled }}
69+
volumeClaimTemplates:
70+
- metadata:
71+
name: jupyter
72+
spec:
73+
accessModes: [ "ReadWriteOnce" ]
74+
resources:
75+
requests:
76+
storage: "{{ .Values.persistence.size }}"
77+
{{- if .Values.persistence.storageClass }}
78+
{{- if (eq "-" .Values.persistence.storageClass) }}
79+
storageClassName: ""
80+
{{- else }}
81+
storageClassName: "{{ .Values.persistence.storageClass }}"
82+
{{- end }}
83+
{{- end }}
84+
{{- end }}
85+
86+

charts/jupyter/values.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Default values for jupyter.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
image:
6+
repository: gradiant/jupyter
7+
tag: 6.0.1
8+
pullPolicy: IfNotPresent
9+
10+
lab: true
11+
12+
service:
13+
type: ClusterIP
14+
externalPort: 8888
15+
nodePort:
16+
http:
17+
18+
persistence:
19+
enabled: true
20+
storageClass:
21+
accessMode: ReadWriteOnce
22+
size: 50Gi
23+
24+
## Ingress configuration
25+
## Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/
26+
##
27+
ingress:
28+
enabled: false
29+
annotations: {}
30+
# kubernetes.io/ingress.class: nginx
31+
# kubernetes.io/tls-acme: "true"
32+
path: /
33+
hosts:
34+
- jupyter.127-0-0-1.nip
35+
tls: []
36+
# - secretName: jupyter-tls
37+
# hosts:
38+
# - jupyter.local
39+
40+
resources: {}
41+
# We usually recommend not to specify default resources and to leave this as a conscious
42+
# choice for the user. This also increases chances charts run on environments with little
43+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
44+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
45+
# limits:
46+
# cpu: 100m
47+
# memory: 128Mi
48+
# requests:
49+
# cpu: 100m
50+
# memory: 128Mi
51+
52+
nodeSelector: {}
53+
54+
tolerations: []
55+
56+
affinity: {}

0 commit comments

Comments
 (0)