-
Notifications
You must be signed in to change notification settings - Fork 27
/
hubtraf-chart-values.yaml
89 lines (78 loc) · 3.69 KB
/
hubtraf-chart-values.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This file is not meant to be read programmatically by anything, but only meant
# for administrative reference and manual use of yuvipanda/hubtraf testing of
# the Helm chart. For some related information, see
# https://github.com/neurohackademy/nh2020-jupyterhub/issues/29.
# These are overrides that I want to use while using hubtraf to test the
# deployment. hubploy currently doesn't support passing an entire file with
# --values, so I've also summarized these changes into a big one liner in the
# Helpful scripts section below.
jupyterhub:
hub:
extraConfig:
# --set 'jupyterhub.hub.extraConfig.auth=c.Authenticator.auto_login=False'
auth: |
c.Authenticator.auto_login=False
# --set 'jupyterhub.hub.extraConfig.common_labels=c.KubeSpawner.common_labels.update({'hubtraf': 'delete-me'})'
common_labels: |
c.KubeSpawner.common_labels.update({'hubtraf': 'delete-me'})
# --set 'jupyterhub.hub.extraConfig.options_form=print("Do nothing")'
options_form: |
print("Do nothing")
# --set 'jupyterhub.hub.extraConfig.pre_spawn_hook=print("Do nothing")'
pre_spawn_hook: |
print("Do nothing")
# --set 'jupyterhub.hub.extraConfig.00-acl-parsing=print("Do nothing")'
00-acl-parsing: |
print("Do nothing")
auth:
# --set 'jupyterhub.auth.type=dummy'
type: dummy
singleuser:
# --set-string 'jupyterhub.singleuser.defaultUrl=/tree'
defaultUrl: '/tree'
storage:
# --set 'jupyterhub.singleuser.storage.capacity=1Gi'
capacity: 1Gi
scheduling:
userPlaceholder:
# --set 'jupyterhub.scheduling.userPlaceholder.replicas=40'
replicas: 40
### Helpful scripts
# ----------------------------------------------------------------------------
# Update deployment for use with hubtraf simulation
hubploy deploy --namespace default --cleanup-on-fail hub-neurohackademy-org chart prod \
--set 'jupyterhub.hub.extraConfig.auth=c.Authenticator.auto_login=False' \
--set 'jupyterhub.hub.extraConfig.common_labels=c.KubeSpawner.common_labels.update({"hubtraf": "delete-me"})' \
--set 'jupyterhub.hub.extraConfig.options_form=print("Do nothing")' \
--set 'jupyterhub.hub.extraConfig.pre_spawn_hook=print("Do nothing")' \
--set 'jupyterhub.hub.extraConfig.00-acl-parsing=print("Do nothing")' \
--set 'jupyterhub.auth.type=dummy' \
--set 'jupyterhub.singleuser.defaultUrl=/tree' \
--set 'jupyterhub.singleuser.storage.capacity=1Gi' \
--set 'jupyterhub.scheduling.userPlaceholder.replicas=40'
# Quickly adjust the user-placeholder replicas if wanted
kubectl scale sts/user-placeholder --replicas=120
# Simulate 975 users arriving over 15 minutes time
hubtraf-simulate https://hub.neurohackademy.org 500 \
--user-prefix=hubtraf \
--user-session-min-runtime=500 \
--user-session-max-runtime=600 \
--user-session-max-start-delay=500 \
--json
# Basic monitoring of hubtraf users and k8s nodes
hubtraf_monitor() {
pods="Pods : $(kubectl get pods --field-selector=status.phase=Pending -l hubtraf=delete-me --no-headers 2>/dev/null | wc -l)/$(kubectl get pods -l hubtraf=delete-me --no-headers 2>/dev/null | wc -l) (Pending/Total)";
nodes="Nodes: $(kubectl get nodes --no-headers 2>/dev/null | grep Ready | wc -l)/$(kubectl get nodes --no-headers 2>/dev/null | wc -l) (Ready/Total)";
top=$(kubectl top pod -l "component in (proxy,hub,autohttps)");
echo "$pods";
echo "$nodes";
echo "";
echo "$top";
}
export -f hubtraf_monitor
watch -x bash -c hubtraf_monitor
# Cleanup following tests
kubectl delete pod,pvc -l hubtraf=delete-me
kubectl delete pod,pvc -l component=hub
kubectl scale sts/user-placeholder --replicas=40
# ----------------------------------------------------------------------------