Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions jupyterhub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@

The JupyterHub Helm chart is accompanied with an installation guide at [z2jh.jupyter.org](https://z2jh.jupyter.org). Together they enable you to deploy [JupyterHub](https://jupyterhub.readthedocs.io) in a Kubernetes cluster that can make Jupyter environments available to several thousands of simultaneous users.

## Configuration

For detailed configuration options, see the [official documentation](https://z2jh.jupyter.org).

### Namespace Override

The chart supports deploying resources to a custom namespace via `namespaceOverride`:

```yaml
namespaceOverride: my-custom-namespace
```

This is particularly useful for ArgoCD deployments or when using this chart as a subchart. See the [configuration reference](https://z2jh.jupyter.org/en/stable/resources/reference.html) for more details.

## History

Much of the initial groundwork for this documentation is information learned from the successful use of JupyterHub and Kubernetes at UC Berkeley in their [Data 8](http://data8.org/) program.
Expand Down
10 changes: 10 additions & 0 deletions jupyterhub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,13 @@ limits:
{{- define "jupyterhub.chart-version-to-git-ref" -}}
{{- regexReplaceAll ".*[.-]n\\d+[.]h(.*)" . "${1}" }}
{{- end }}


{{- /*
jupyterhub.namespace:
Returns the namespace for chart resources. Uses .Values.namespaceOverride
if set, otherwise defaults to .Release.Namespace.
*/}}
{{- define "jupyterhub.namespace" -}}
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
1 change: 1 addition & 0 deletions jupyterhub/templates/httproute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1
metadata:
name: {{ include "jupyterhub.httpRoute.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.httpRoute.annotations }}
Expand Down
8 changes: 4 additions & 4 deletions jupyterhub/templates/hub/_helpers-passwords.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{- else if .Values.proxy.secretToken }}
{{- .Values.proxy.secretToken }}
{{- else }}
{{- $k8s_state := lookup "v1" "Secret" .Release.Namespace (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- $k8s_state := lookup "v1" "Secret" (include "jupyterhub.namespace" .) (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- if hasKey $k8s_state.data "hub.config.ConfigurableHTTPProxy.auth_token" }}
{{- index $k8s_state.data "hub.config.ConfigurableHTTPProxy.auth_token" | b64dec }}
{{- else }}
Expand All @@ -52,7 +52,7 @@
{{- else if .Values.hub.cookieSecret }}
{{- .Values.hub.cookieSecret }}
{{- else }}
{{- $k8s_state := lookup "v1" "Secret" .Release.Namespace (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- $k8s_state := lookup "v1" "Secret" (include "jupyterhub.namespace" .) (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- if hasKey $k8s_state.data "hub.config.JupyterHub.cookie_secret" }}
{{- index $k8s_state.data "hub.config.JupyterHub.cookie_secret" | b64dec }}
{{- else }}
Expand All @@ -65,7 +65,7 @@
{{- if (.Values.hub.config | dig "CryptKeeper" "keys" "") }}
{{- .Values.hub.config.CryptKeeper.keys | join ";" }}
{{- else }}
{{- $k8s_state := lookup "v1" "Secret" .Release.Namespace (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- $k8s_state := lookup "v1" "Secret" (include "jupyterhub.namespace" .) (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- if hasKey $k8s_state.data "hub.config.CryptKeeper.keys" }}
{{- index $k8s_state.data "hub.config.CryptKeeper.keys" | b64dec }}
{{- else }}
Expand All @@ -81,7 +81,7 @@
{{- if $explicitly_set_api_token }}
{{- $explicitly_set_api_token }}
{{- else }}
{{- $k8s_state := lookup "v1" "Secret" $_.Release.Namespace (include "jupyterhub.hub.fullname" $_) | default (dict "data" (dict)) }}
{{- $k8s_state := lookup "v1" "Secret" (include "jupyterhub.namespace" $_) (include "jupyterhub.hub.fullname" $_) | default (dict "data" (dict)) }}
{{- $k8s_secret_key := print "hub.services." $service_key ".apiToken" }}
{{- if hasKey $k8s_state.data $k8s_secret_key }}
{{- index $k8s_state.data $k8s_secret_key | b64dec }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
data:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "jupyterhub.hub-pvc.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.hub.db.pvc.annotations }}
Expand Down
4 changes: 3 additions & 1 deletion jupyterhub/templates/hub/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
rules:
Expand All @@ -17,12 +18,13 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "jupyterhub.hub-serviceaccount.fullname" . }}
namespace: "{{ .Release.Namespace }}"
namespace: {{ include "jupyterhub.namespace" . }}
roleRef:
kind: Role
name: {{ include "jupyterhub.hub.fullname" . }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ kind: Secret
apiVersion: v1
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
type: Opaque
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "jupyterhub.hub.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
annotations:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/hub/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.hub-serviceaccount.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
{{- with .Values.hub.serviceAccount.annotations }}
annotations:
{{- . | toYaml | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/image-pull-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Secret
apiVersion: v1
metadata:
name: {{ include "jupyterhub.image-pull-secret.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
annotations:
Expand Down
3 changes: 2 additions & 1 deletion jupyterhub/templates/image-puller/_helpers-daemonset.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
{{- else }}
name: {{ include "jupyterhub.continuous-image-puller.fullname" . }}
{{- end }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- if .hook }}
Expand Down Expand Up @@ -286,7 +287,7 @@ spec:
{{- if .Values.prePuller.hook.enabled }}
{{- if .Values.prePuller.hook.pullOnlyOnChanges }}
{{- $new_checksum := include "jupyterhub.imagePuller.daemonset.hook.checksum" . }}
{{- $k8s_state := lookup "v1" "ConfigMap" .Release.Namespace (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- $k8s_state := lookup "v1" "ConfigMap" (include "jupyterhub.namespace" .) (include "jupyterhub.hub.fullname" .) | default (dict "data" (dict)) }}
{{- $old_checksum := index $k8s_state.data "checksum_hook-image-puller" | default "" }}
{{- if ne $new_checksum $old_checksum -}}
# prePuller.hook.enabled={{ .Values.prePuller.hook.enabled }}
Expand Down
3 changes: 2 additions & 1 deletion jupyterhub/templates/image-puller/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "jupyterhub.hook-image-awaiter.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand Down Expand Up @@ -62,7 +63,7 @@ spec:
- -ca-path=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
- -auth-token-path=/var/run/secrets/kubernetes.io/serviceaccount/token
- -api-server-address=https://kubernetes.default.svc:$(KUBERNETES_SERVICE_PORT)
- -namespace={{ .Release.Namespace }}
- -namespace={{ include "jupyterhub.namespace" . }}
- -daemonset={{ include "jupyterhub.hook-image-puller.fullname" . }}
- -pod-scheduling-wait-duration={{ .Values.prePuller.hook.podSchedulingWaitDuration }}
{{- with .Values.prePuller.hook.containerSecurityContext }}
Expand Down
2 changes: 1 addition & 1 deletion jupyterhub/templates/image-puller/priorityclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
name: {{ include "jupyterhub.image-puller-priority.fullname" . }}
annotations:
meta.helm.sh/release-name: "{{ .Release.Name }}"
meta.helm.sh/release-namespace: "{{ .Release.Namespace }}"
meta.helm.sh/release-namespace: {{ include "jupyterhub.namespace" . | quote }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
value: {{ .Values.scheduling.podPriority.imagePullerPriority }}
Expand Down
4 changes: 3 additions & 1 deletion jupyterhub/templates/image-puller/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "jupyterhub.hook-image-awaiter.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand All @@ -26,6 +27,7 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "jupyterhub.hook-image-awaiter.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand All @@ -36,7 +38,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ include "jupyterhub.hook-image-awaiter-serviceaccount.fullname" . }}
namespace: "{{ .Release.Namespace }}"
namespace: {{ include "jupyterhub.namespace" . }}
roleRef:
kind: Role
name: {{ include "jupyterhub.hook-image-awaiter.fullname" . }}
Expand Down
35 changes: 18 additions & 17 deletions jupyterhub/templates/image-puller/serviceaccount-continuous.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{{- /*
ServiceAccount for the continuous image-puller daemonset
*/}}
{{- if .Values.prePuller.continuous.serviceAccount.create -}}
{{- if .Values.prePuller.continuous.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.continuous-image-puller.fullname" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
annotations:
{{- with .Values.prePuller.continuous.serviceAccount.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- /*
ServiceAccount for the continuous image-puller daemonset
*/}}
{{- if .Values.prePuller.continuous.serviceAccount.create -}}
{{- if .Values.prePuller.continuous.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.continuous-image-puller.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
annotations:
{{- with .Values.prePuller.continuous.serviceAccount.annotations }}
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions jupyterhub/templates/image-puller/serviceaccount-hook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.hook-image-puller-serviceaccount.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/image-puller/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.hook-image-awaiter-serviceaccount.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
hub.jupyter.org/deletable: "true"
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "jupyterhub.ingress.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: {{ include "jupyterhub.autohttps.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
data:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "jupyterhub.autohttps.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "jupyterhub.autohttps.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: proxy
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
3 changes: 3 additions & 0 deletions jupyterhub/templates/proxy/autohttps/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "jupyterhub.autohttps.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.proxy.traefik.serviceAccount.annotations }}
Expand All @@ -21,11 +22,13 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "jupyterhub.autohttps.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "jupyterhub.autohttps-serviceaccount.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
apiGroup:
roleRef:
kind: Role
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "jupyterhub.proxy-http.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- with .Values.proxy.service.labels }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/autohttps/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "jupyterhub.autohttps-serviceaccount.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "jupyterhub.proxy.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/netpol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ include "jupyterhub.proxy.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
1 change: 1 addition & 0 deletions jupyterhub/templates/proxy/pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "jupyterhub.proxy.fullname" . }}
namespace: {{ include "jupyterhub.namespace" . }}
labels:
{{- include "jupyterhub.labels" . | nindent 4 }}
spec:
Expand Down
Loading