Skip to content

Commit

Permalink
Merge pull request #69 from UNINETTSigma2/jupyter-home-folder
Browse files Browse the repository at this point in the history
Added option to specify home folder
  • Loading branch information
sirikal authored Sep 13, 2024
2 parents 74a590f + 913278f commit 351bd4c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion repos/testing/jupyter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Jupyter notebook with Dataporten integration
name: jupyter
version: 0.10.33
version: 0.10.34
maintainers:
- name: Sigma2 AS
email: [email protected]
Expand Down
5 changes: 5 additions & 0 deletions repos/testing/jupyter/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ properties:
description: "The oauth token to pass to the Jupyter GitHub integration."
examples:
- ""
userHome:
description: "The subfolder to use when storing the users home directory."
type: string
examples:
- home
appstore_generated_data:
type: object
properties:
Expand Down
4 changes: 2 additions & 2 deletions repos/testing/jupyter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ c.NotebookApp.base_url = '/'
c.NotebookApp.trust_xheaders = True
c.NotebookApp.tornado_settings = {'static_url_prefix': '/static/'}
{{ if ne (first .Values.persistentStorage).existingClaim "" }}
c.NotebookApp.notebook_dir = '/home/{{ .Values.username }}'
c.NotebookApp.notebook_dir = '/{{ .Values.advanced.userHome }}/{{ .Values.username }}'
{{ else }}
c.NotebookApp.notebook_dir = '/home/notebook'
{{ end }}
Expand Down Expand Up @@ -130,7 +130,7 @@ gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologi
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
jovyan:x:1000:100::/home/jovyan:/bin/bash
{{ .Values.username }}:x:{{ .Values.uid }}:{{ .Values.gid }}::/home/{{ .Values.username }}:/bin/bash
{{ .Values.username }}:x:{{ .Values.uid }}:{{ .Values.gid }}::/{{ .Values.advanced.userHome }}/{{ .Values.username }}:/bin/bash
notebook:x:999:999::/home/notebook:/bin/bash

{{- end -}}
Expand Down
16 changes: 8 additions & 8 deletions repos/testing/jupyter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ spec:
- /bin/sh
- -c
- -x
- "mkdir -p /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/home/{{ .Values.username }}/.jupyter && chmod g+w /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/home"
- "mkdir -p /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/{{ .Values.advanced.userHome }}/{{ .Values.username }}/.jupyter && chmod g+w /mnt/{{ (first .Values.persistentStorage).existingClaimName }}/{{ .Values.advanced.userHome }}"
volumeMounts:
{{- range .Values.persistentStorage }}
- name: {{ .existingClaimName }}
Expand Down Expand Up @@ -113,7 +113,7 @@ spec:
image: {{ .Values.advanced.dockerImage }}
args: ["/usr/local/bin/start-notebook.sh"]
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
workingDir: /home/{{ .Values.username }}
workingDir: /{{ .Values.advanced.userHome }}/{{ .Values.username }}
{{ end }}
env:
{{ if .Values.advanced.env.jupyterLab }}
Expand All @@ -132,9 +132,9 @@ spec:
value: '1'
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
- name: XDG_CACHE_HOME
value: /home/{{ .Values.username }}/.cache
value: /{{ .Values.advanced.userHome }}/{{ .Values.username }}/.cache
- name: HOME
value: /home/{{ .Values.username }}
value: /{{ .Values.advanced.userHome }}/{{ .Values.username }}
- name: USER
value: {{ .Values.username }}
- name: PVC_MOUNT_PATH
Expand All @@ -161,12 +161,12 @@ spec:
volumeMounts:
{{- if ne (first .Values.persistentStorage).existingClaim "" }}
- name: notebook-config
mountPath: /home/{{ .Values.username }}/.jupyter/notebook_config.py
mountPath: /{{ .Values.advanced.userHome }}/{{ .Values.username }}/.jupyter/notebook_config.py
subPath: notebook_config.py
mountPropagation: HostToContainer
{{- else }}
- name: notebook-config
mountPath: /home/notebook/.jupyter/notebook_config.py
mountPath: /{{ .Values.advanced.userHome }}/notebook/.jupyter/notebook_config.py
subPath: notebook_config.py
{{ end }}
- name: passwd
Expand All @@ -188,7 +188,7 @@ spec:
{{ end }}
{{- end }}
- name: {{ (first .Values.persistentStorage).existingClaimName }}
mountPath: /home/{{ .Values.username }}
subPath: home/{{ .Values.username }}
mountPath: /{{ .Values.advanced.userHome }}/{{ .Values.username }}
subPath: {{ .Values.advanced.userHome }}/{{ .Values.username }}
mountPropagation: HostToContainer
{{- end -}}
1 change: 1 addition & 0 deletions repos/testing/jupyter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ supplementalGroups:
- name: ""
gid: ""
advanced:
userHome: home
env:
sparkMasterUrl: "local[*]"
jupyterLab: true
Expand Down

0 comments on commit 351bd4c

Please sign in to comment.