Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit a1c7bfd

Browse files
authored
Jupyterhub Idle Culler update (#568)
* Add timeout env var to culler and modify overlay * Add limits/requests to culler * Add culler timeout to jupyterhub-cfg * Add readme section
1 parent 0fb7041 commit a1c7bfd

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

jupyterhub/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ Notebook Images do not provide any parameters.
7474

7575
Notebook Images component comes with 3 overlays.
7676

77+
#### [jupyterhub-idle-culler](jupyterhub/overlays/jupyterhub-idle-culler)
78+
79+
Adds a `DeploymentConfig` of the jupyterhub idle culler. It enables shutting down notebooks that are idle for a certain amount of time.
80+
81+
Changes to the culling timeout value can either be made in the `jupyterhub-cfg` `ConfigMap` or in the cluster settings section of the ODH Dashboard.
82+
83+
**Note:** The culling timeout value in the dashboard and manual configuration fo the culler will **not** work if this overlay is deployed together with the operator, as any change to the jupyterhub-cfg `ConfigMap` will be reverted.
84+
85+
86+
Jupyterhub-idle-culler repository: https://github.com/jupyterhub/jupyterhub-idle-culler
87+
7788
#### [additional](notebook-images/overlays/additional/)
7889

7990
Contains additional Jupyter notebook images.

jupyterhub/jupyterhub/base/jupyterhub-configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ data:
1111
gpu_mode: ""
1212
singleuser_pvc_size: 2Gi
1313
notebook_destination: "$(notebook_destination)"
14+
culler_timeout: "31536000" # 1 year in seconds
1415

1516
---
1617
apiVersion: v1

jupyterhub/jupyterhub/overlays/jupyterhub-idle-culler/deploymentconfig.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ spec:
1111
labels:
1212
app: jupyterhub-idle-culler
1313
spec:
14+
initContainers:
15+
- name: check-for-jh
16+
image: 'quay.io/odh-jupyterhub/jupyterhub-img:v0.3.3'
17+
command:
18+
- /bin/sh
19+
- '-c'
20+
- 'while ! curl jupyterhub:8081/hub/api; do sleep 5; done'
21+
resources:
22+
limits:
23+
cpu: 150m
24+
memory: 50Mi
25+
requests:
26+
cpu: 150m
27+
memory: 20Mi
28+
terminationMessagePath: /dev/termination-log
29+
terminationMessagePolicy: File
30+
imagePullPolicy: IfNotPresent
1431
containers:
1532
- name: jupyterhub-idle-culler
1633
image: quay.io/odh-jupyterhub/jupyterhub-img:v0.3.5
@@ -20,9 +37,21 @@ spec:
2037
secretKeyRef:
2138
name: jupyterhub-idle-culler
2239
key: token
40+
- name: CULLER_TIMEOUT
41+
valueFrom:
42+
configMapKeyRef:
43+
name: jupyterhub-cfg
44+
key: culler_timeout
45+
resources:
46+
limits:
47+
cpu: 150m
48+
memory: 50Mi
49+
requests:
50+
cpu: 150m
51+
memory: 50Mi
2352
command:
2453
- jupyterhub-idle-culler
25-
- --timeout=259200 # 3 days
54+
- --timeout=$(CULLER_TIMEOUT) # in seconds
2655
- --url=jupyterhub:8081/hub/api
2756
triggers:
2857
- type: ConfigChange

jupyterhub/jupyterhub/overlays/jupyterhub-idle-culler/kustomization.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ kind: Kustomization
44
commonLabels:
55
app.kubernetes.io/part-of: jupyterhub
66

7+
bases:
8+
- ../../base
79
resources:
8-
- deploymentconfig.yaml
10+
- ./deploymentconfig.yaml

0 commit comments

Comments
 (0)