forked from jupyterhub/zero-to-jupyterhub-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
values.schema.yaml
2933 lines (2657 loc) · 118 KB
/
values.schema.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This schema (a jsonschema in YAML format) is used to generate
# values.schema.json which is packaged with the Helm chart for client side
# validation by helm of values before template rendering.
#
# This schema is also used by our documentation system to build the
# configuration reference section based on the description fields. See
# docs/source/conf.py for that logic!
#
# We look to document everything we have default values for in values.yaml, but
# we don't look to enforce the perfect validation logic within this file.
#
# ref: https://json-schema.org/learn/getting-started-step-by-step.html
#
$schema: http://json-schema.org/draft-07/schema#
type: object
additionalProperties: false
required:
- imagePullSecrets
- hub
- proxy
- singleuser
- ingress
- prePuller
- custom
- cull
- debug
- rbac
- global
properties:
enabled:
type: [boolean, "null"]
description: |
`enabled` is ignored by the jupyterhub chart itself, but a chart depending
on the jupyterhub chart conditionally can make use this config option as
the condition.
fullnameOverride:
type: [string, "null"]
description: |
fullnameOverride and nameOverride allow you to adjust how the resources
part of the Helm chart are named.
Name format | Resource types | fullnameOverride | nameOverride | Note
------------------------- | -------------- | ---------------- | ------------ | -
component | namespaced | `""` | * | Default
release-component | cluster wide | `""` | * | Default
fullname-component | * | str | * | -
release-component | * | null | `""` | -
release-(name-)component | * | null | str | omitted if contained in release
release-(chart-)component | * | null | null | omitted if contained in release
```{admonition} Warning!
:class: warning
Changing fullnameOverride or nameOverride after the initial installation
of the chart isn't supported. Changing their values likely leads to a
reset of non-external JupyterHub databases, abandonment of users' storage,
and severed couplings to currently running user pods.
```
If you are a developer of a chart depending on this chart, you should
avoid hardcoding names. If you want to reference the name of a resource in
this chart from a parent helm chart's template, you can make use of the
global named templates instead.
```yaml
# some pod definition of a parent chart helm template
schedulerName: {{ include "jupyterhub.user-scheduler.fullname" . }}
```
To access them from a container, you can also rely on the hub ConfigMap
that contains entries of all the resource names.
```yaml
# some container definition in a parent chart helm template
env:
- name: SCHEDULER_NAME
valueFrom:
configMapKeyRef:
name: {{ include "jupyterhub.user-scheduler.fullname" . }}
key: user-scheduler
```
nameOverride:
type: [string, "null"]
description: |
See the documentation under [`fullnameOverride`](schema_fullnameOverride).
imagePullSecret:
type: object
required: [create]
if:
properties:
create:
const: true
then:
additionalProperties: false
required: [registry, username, password]
description: |
This is configuration to create a k8s Secret resource of `type:
kubernetes.io/dockerconfigjson`, with credentials to pull images from a
private image registry. If you opt to do so, it will be available for use
by all pods in their respective `spec.imagePullSecrets` alongside other
k8s Secrets defined in `imagePullSecrets` or the pod respective
`...image.pullSecrets` configuration.
In other words, using this configuration option can automate both the
otherwise manual creation of a k8s Secret and the otherwise manual
configuration to reference this k8s Secret in all the pods of the Helm
chart.
```sh
# you won't need to create a k8s Secret manually...
kubectl create secret docker-registry image-pull-secret \
--docker-server=<REGISTRY> \
--docker-username=<USERNAME> \
--docker-email=<EMAIL> \
--docker-password=<PASSWORD>
```
If you just want to let all Pods reference an existing secret, use the
[`imagePullSecrets`](schema_imagePullSecrets) configuration instead.
properties:
create:
type: boolean
description: |
Toggle the creation of the k8s Secret with provided credentials to
access a private image registry.
automaticReferenceInjection:
type: boolean
description: |
Toggle the automatic reference injection of the created Secret to all
pods' `spec.imagePullSecrets` configuration.
registry:
type: string
description: |
Name of the private registry you want to create a credential set for.
It will default to Docker Hub's image registry.
Examples:
- https://index.docker.io/v1/
- quay.io
- eu.gcr.io
- alexmorreale.privatereg.net
username:
type: string
description: |
Name of the user you want to use to connect to your private registry.
For external gcr.io, you will use the `_json_key`.
Examples:
- alexmorreale
- alex@pfc.com
- _json_key
password:
type: string
description: |
Password for the private image registry's user.
Examples:
- plaintextpassword
- abc123SECRETzyx098
For gcr.io registries the password will be a big JSON blob for a
Google cloud service account, it should look something like below.
```yaml
password: |-
{
"type": "service_account",
"project_id": "jupyter-se",
"private_key_id": "f2ba09118a8d3123b3321bd9a7d6d0d9dc6fdb85",
...
}
```
email:
type: [string, "null"]
description: |
Specification of an email is most often not required, but it is
supported.
imagePullSecrets:
type: array
description: |
Chart wide configuration to _append_ k8s Secret references to all its
pod's `spec.imagePullSecrets` configuration.
This will not override or get overridden by pod specific configuration,
but instead augment the pod specific configuration.
You can use both the k8s native syntax, where each list element is like
`{"name": "my-secret-name"}`, or you can let list elements be strings
naming the secrets directly.
hub:
type: object
additionalProperties: false
required: [baseUrl]
properties:
revisionHistoryLimit: &revisionHistoryLimit
type: [integer, "null"]
minimum: 0
description: |
Configures the resource's `spec.revisionHistoryLimit`. This is
available for Deployment, StatefulSet, and DaemonSet resources.
See the [Kubernetes docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#revision-history-limit)
for more info.
config:
type: object
additionalProperties: true
description: |
JupyterHub and its components (authenticators, spawners, etc), are
Python classes that expose its configuration through
[_traitlets_](https://traitlets.readthedocs.io/en/stable/). With this
Helm chart configuration (`hub.config`), you can directly configure
the Python classes through _static_ YAML values. To _dynamically_ set
values, you need to use [`hub.extraConfig`](schema_hub.extraConfig)
instead.
```{admonition} Currently intended only for auth config
:class: warning
This config _currently_ (0.11.0) only influence the software in the
`hub` Pod, but some Helm chart config options such as
[`hub.baseUrl`](schema_hub.baseUrl) is used to set
`JupyterHub.base_url` in the `hub` Pod _and_ influence how other Helm
templates are rendered.
As we have not yet mapped out all the potential configuration
conflicts except for the authentication related configuration options,
please accept that using it for something else at this point can lead
to issues.
```
__Example__
If you inspect documentation or some `jupyterhub_config.py` to contain
the following section:
```python
c.JupyterHub.admin_access = true
c.JupyterHub.admin_users = ["jovyan1", "jovyan2"]
c.KubeSpawner.k8s_api_request_timeout = 10
c.GitHubOAuthenticator.allowed_organizations = ["jupyterhub"]
```
Then, you would be able to represent it with this configuration like:
```yaml
hub:
config:
JupyterHub:
admin_access: true
admin_users:
- jovyan1
- jovyan2
KubeSpawner:
k8s_api_request_timeout: 10
GitHubOAuthenticator:
allowed_organizations:
- jupyterhub
```
```{admonition} YAML limitations
:class: tip
You can't represent Python `Bytes` or `Set` objects in YAML directly.
```
```{admonition} Helm value merging
:class: tip
`helm` merges a Helm chart's default values with values passed with
the `--values` or `-f` flag. During merging, lists are replaced while
dictionaries are updated.
```
extraFiles: &extraFiles
type: object
additionalProperties: false
description: |
A dictionary with extra files to be injected into the pod's container
on startup. This can for example be used to inject: configuration
files, custom user interface templates, images, and more.
```yaml
# NOTE: "hub" is used in this example, but the configuration is the
# same for "singleuser".
hub:
extraFiles:
# The file key is just a reference that doesn't influence the
# actual file name.
<file key>:
# mountPath is required and must be the absolute file path.
mountPath: <full file path>
# Choose one out of the three ways to represent the actual file
# content: data, stringData, or binaryData.
#
# data should be set to a mapping (dictionary). It will in the
# end be rendered to either YAML, JSON, or TOML based on the
# filename extension that are required to be either .yaml, .yml,
# .json, or .toml.
#
# If your content is YAML, JSON, or TOML, it can make sense to
# use data to represent it over stringData as data can be merged
# instead of replaced if set partially from separate Helm
# configuration files.
#
# Both stringData and binaryData should be set to a string
# representing the content, where binaryData should be the
# base64 encoding of the actual file content.
#
data:
myConfig:
myMap:
number: 123
string: "hi"
myList:
- 1
- 2
stringData: |
hello world!
binaryData: aGVsbG8gd29ybGQhCg==
# mode is by default 0644 and you can optionally override it
# either by octal notation (example: 0400) or decimal notation
# (example: 256).
mode: <file system permissions>
```
**Using --set-file**
To avoid embedding entire files in the Helm chart configuration, you
can use the `--set-file` flag during `helm upgrade` to set the
stringData or binaryData field.
```yaml
hub:
extraFiles:
my_image:
mountPath: /usr/local/share/jupyterhub/static/my_image.png
# Files in /usr/local/etc/jupyterhub/jupyterhub_config.d are
# automatically loaded in alphabetical order of the final file
# name when JupyterHub starts.
my_config:
mountPath: /usr/local/etc/jupyterhub/jupyterhub_config.d/my_jupyterhub_config.py
```
```bash
# --set-file expects a text based file, so you need to base64 encode
# it manually first.
base64 my_image.png > my_image.png.b64
helm upgrade <...> \
--set-file hub.extraFiles.my_image.binaryData=./my_image.png.b64 \
--set-file hub.extraFiles.my_config.stringData=./my_jupyterhub_config.py
```
**Common uses**
1. **JupyterHub template customization**
You can replace the default JupyterHub user interface templates in
the hub pod by injecting new ones to
`/usr/local/share/jupyterhub/templates`. These can in turn
reference custom images injected to
`/usr/local/share/jupyterhub/static`.
1. **JupyterHub standalone file config**
Instead of embedding JupyterHub python configuration as a string
within a YAML file through
[`hub.extraConfig`](schema_hub.extraConfig), you can inject a
standalone .py file into
`/usr/local/etc/jupyterhub/jupyterhub_config.d` that is
automatically loaded.
1. **Flexible configuration**
By injecting files, you don't have to embed them in a docker image
that you have to rebuild.
If your configuration file is a YAML/JSON/TOML file, you can also
use `data` instead of `stringData` which allow you to set various
configuration in separate Helm config files. This can be useful to
help dependent charts override only some configuration part of the
file, or to allow for the configuration be set through multiple
Helm configuration files.
**Limitations**
1. File size
The files in `hub.extraFiles` and `singleuser.extraFiles` are
respectively stored in their own k8s Secret resource. As k8s
Secret's are limited, typically to 1MB, you will be limited to a
total file size of less than 1MB as there is also base64 encoding
that takes place reducing available capacity to 75%.
2. File updates
The files that are mounted are only set during container startup.
This is [because we use
`subPath`](https://kubernetes.io/docs/concepts/storage/volumes/#secret)
as is required to avoid replacing the content of the entire
directory we mount in.
patternProperties:
".*":
type: object
additionalProperties: false
required: [mountPath]
oneOf:
- required: [data]
- required: [stringData]
- required: [binaryData]
properties:
mountPath:
type: string
data:
type: object
additionalProperties: true
stringData:
type: string
binaryData:
type: string
mode:
type: number
baseUrl:
type: string
description: |
This is the equivalent of c.JupyterHub.base_url, but it is also needed
by the Helm chart in general. So, instead of setting
c.JupyterHub.base_url, use this configuration.
command:
type: array
description: |
A list of strings to be used to replace the JupyterHub image's
`ENTRYPOINT` entry. Note that in k8s lingo, the Dockerfile's
`ENTRYPOINT` is called `command`. The list of strings will be expanded
with Helm's template function `tpl` which can render Helm template
logic inside curly braces (`{{... }}`).
This could be useful to wrap the invocation of JupyterHub itself in
some custom way.
For more details, see the [Kubernetes
documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/).
args:
type: array
description: |
A list of strings to be used to replace the JupyterHub image's `CMD`
entry as well as the Helm chart's default way to start JupyterHub.
Note that in k8s lingo, the Dockerfile's `CMD` is called `args`. The
list of strings will be expanded with Helm's template function `tpl`
which can render Helm template logic inside curly braces (`{{... }}`).
```{warning}
By replacing the entire configuration file, which is mounted to
`/usr/local/etc/jupyterhub/jupyterhub_config.py` by the Helm chart,
instead of appending to it with `hub.extraConfig`, you expose your
deployment for issues stemming from getting out of sync with the Helm
chart's config file.
These kind of issues will be significantly harder to debug and
diagnose, and can due to this could cause a lot of time expenditure
for both the community maintaining the Helm chart as well as yourself,
even if this wasn't the reason for the issue.
Due to this, we ask that you do your _absolute best to avoid replacing
the default provided `jupyterhub_config.py` file. It can often be
possible. For example, if your goal is to have a dedicated .py file
for more extensive additions that you can syntax highlight and such
and feel limited by passing code in `hub.extraConfig` which is part of
a YAML file, you can use [this
trick](https://github.com/jupyterhub/zero-to-jupyterhub-k8s/issues/1580#issuecomment-707776237)
instead.
```
```yaml
hub:
args:
- "jupyterhub"
- "--config"
- "/usr/local/etc/jupyterhub/jupyterhub_config.py"
- "--debug"
- "--upgrade-db"
```
For more details, see the [Kubernetes
documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/).
cookieSecret:
type: [string, "null"]
description: |
```{note}
As of version 1.0.0 this will automatically be generated and there is
no need to set it manually.
If you wish to reset a generated key, you can use `kubectl edit` on
the k8s Secret typically named `hub` and remove the
`hub.config.JupyterHub.cookie_secret` entry in the k8s Secret, then
perform a new `helm upgrade`.
```
A 32-byte cryptographically secure randomly generated string used to sign values of
secure cookies set by the hub. If unset, jupyterhub will generate one on startup and
save it in the file `jupyterhub_cookie_secret` in the `/srv/jupyterhub` directory of
the hub container. A value set here will make JupyterHub overwrite any previous file.
You do not need to set this at all if you are using the default configuration for
storing databases - sqlite on a persistent volume (with `hub.db.type` set to the
default `sqlite-pvc`). If you are using an external database, then you must set this
value explicitly - or your users will keep getting logged out each time the hub pod
restarts.
Changing this value will all user logins to be invalidated. If this secret leaks,
*immediately* change it to something else, or user data can be compromised
```sh
# to generate a value, run
openssl rand -hex 32
```
image: &image-spec
type: object
additionalProperties: false
required: [name, tag]
description: |
Set custom image name, tag, pullPolicy, or pullSecrets for the pod.
properties:
name:
type: string
description: |
The name of the image, without the tag.
```
# example name
gcr.io/my-project/my-image
```
tag:
type: string
description: |
The tag of the image to pull. This is the value following `:` in
complete image specifications.
```
# example tags
v1.11.1
zhy270a
```
pullPolicy:
enum: [null, "", IfNotPresent, Always, Never]
description: |
Configures the Pod's `spec.imagePullPolicy`.
See the [Kubernetes docs](https://kubernetes.io/docs/concepts/containers/images/#updating-images)
for more info.
pullSecrets:
type: array
description: |
A list of references to existing Kubernetes Secrets with
credentials to pull the image.
This Pod's final `imagePullSecrets` k8s specification will be a
combination of:
1. This list of k8s Secrets, specific for this pod.
2. The list of k8s Secrets, for use by all pods in the Helm chart,
declared in this Helm charts configuration called
`imagePullSecrets`.
3. A k8s Secret, for use by all pods in the Helm chart, if
conditionally created from image registry credentials provided
under `imagePullSecret` if `imagePullSecret.create` is set to
true.
```yaml
# example - k8s native syntax
pullSecrets:
- name: my-k8s-secret-with-image-registry-credentials
# example - simplified syntax
pullSecrets:
- my-k8s-secret-with-image-registry-credentials
```
networkPolicy: &networkPolicy-spec
type: object
additionalProperties: false
description: |
This configuration regards the creation and configuration of a k8s
_NetworkPolicy resource_.
properties:
enabled:
type: boolean
description: |
Toggle the creation of the NetworkPolicy resource targeting this
pod, and by doing so, restricting its communication to only what
is explicitly allowed in the NetworkPolicy.
ingress:
type: array
description: |
Additional ingress rules to add besides those that are required
for core functionality.
egress:
type: array
description: |
Additional egress rules to add besides those that are required for
core functionality and those added via
[`.egressAllowRules`](schema_hub.networkPolicy.egressAllowRules).
```{versionchanged} 2.0.0
The default value changed from providing one very permissive rule
allowing all egress to providing no rule. The permissive rule is
still provided via
[`.egressAllowRules`](schema_hub.networkPolicy.egressAllowRules)
set to true though.
```
As an example, below is a configuration that disables the more
broadly permissive `.privateIPs` egress allow rule for the hub
pod, and instead provides tightly scoped permissions to access a
specific k8s local service as identified by pod labels.
```yaml
hub:
networkPolicy:
egressAllowRules:
privateIPs: false
egress:
- to:
- podSelector:
matchLabels:
app: my-k8s-local-service
ports:
- protocol: TCP
port: 5978
```
egressAllowRules:
type: object
additionalProperties: false
description: |
This is a set of predefined rules that when enabled will be added
to the NetworkPolicy list of egress rules.
The resulting egress rules will be a composition of:
- rules specific for the respective pod(s) function within the
Helm chart
- rules based on enabled `egressAllowRules` flags
- rules explicitly specified by the user
```{note}
Each flag under this configuration will not render into a
dedicated rule in the NetworkPolicy resource, but instead combine
with the other flags to a reduced set of rules to avoid a
performance penalty.
```
```{versionadded} 2.0.0
All `egressAllowRules` are new in JupyterHub Helm chart 2.0.0.
```
properties:
cloudMetadataServer:
type: boolean
description: |
Defaults to `false` for singleuser servers, but to `true` for
all other network policies.
When enabled this rule allows the respective pod(s) to
establish outbound connections to the cloud metadata server.
Note that the `nonPrivateIPs` rule is allowing all non Private
IP ranges but makes an exception for the cloud metadata
server, leaving this as the definitive configuration to allow
access to the cloud metadata server.
dnsPortsPrivateIPs:
type: boolean
description: |
Defaults to `true` for all network policies.
When enabled this rule allows the respective pod(s) to
establish outbound connections to private IPs via port 53.
Note that we can't reliably identify the k8s internal DNS
server due to variations between k8s clusters. Due to that,
this rule which is critical for core functionality, can be
disabled for a more refined custom rule.
nonPrivateIPs:
type: boolean
description: |
Defaults to `true` for all network policies.
When enabled this rule allows the respective pod(s) to
establish outbound connections to the non-private IP ranges
with the exception of the cloud metadata server. This means
respective pod(s) can establish connections to the internet
but not (say) an unsecured prometheus server running in the
same cluster.
privateIPs:
type: boolean
description: |
Defaults to `false` for singleuser servers, but to `true` for
all other network policies.
Private IPs refer to the IP ranges `10.0.0.0/8`,
`172.16.0.0/12`, `192.168.0.0/16`.
When enabled this rule allows the respective pod(s) to
establish outbound connections to the internal k8s cluster.
This means users can access the internet but not (say) an
unsecured prometheus server running in the same cluster.
Since not all workloads in the k8s cluster may have
NetworkPolicies setup to restrict their incoming connections,
having this set to false can be a good defense against
malicious intent from someone in control of software in these
pods.
If possible, try to avoid setting this to true as it gives
broad permissions that could be specified more directly via
the [`.egress`](schema_singleuser.networkPolicy.egress).
interNamespaceAccessLabels:
enum: [accept, ignore]
description: |
This configuration option determines if both namespaces and pods
in other namespaces, that have specific access labels, should be
accepted to allow ingress (set to `accept`), or, if the labels are
to be ignored when applied outside the local namespace (set to
`ignore`).
The available access labels for respective NetworkPolicy resources
are:
- `hub.jupyter.org/network-access-hub: "true"` (hub)
- `hub.jupyter.org/network-access-proxy-http: "true"` (proxy.chp, proxy.traefik)
- `hub.jupyter.org/network-access-proxy-api: "true"` (proxy.chp)
- `hub.jupyter.org/network-access-singleuser: "true"` (singleuser)
allowedIngressPorts:
type: array
description: |
A rule to allow ingress on these ports will be added no matter
what the origin of the request is. The default setting for
`proxy.chp` and `proxy.traefik`'s networkPolicy configuration is
`[http, https]`, while it is `[]` for other networkPolicies.
Note that these port names or numbers target a Pod's port name or
number, not a k8s Service's port name or number.
db:
type: object
additionalProperties: false
properties:
type:
enum: [sqlite-pvc, sqlite-memory, mysql, postgres, other]
description: |
Type of database backend to use for the hub database.
The Hub requires a persistent database to function, and this lets you specify
where it should be stored.
The various options are:
1. **sqlite-pvc**
Use an `sqlite` database kept on a persistent volume attached to the hub.
By default, this disk is created by the cloud provider using
*dynamic provisioning* configured by a [storage
class](https://kubernetes.io/docs/concepts/storage/storage-classes/).
You can customize how this disk is created / attached by
setting various properties under `hub.db.pvc`.
This is the default setting, and should work well for most cloud provider
deployments.
2. **sqlite-memory**
Use an in-memory `sqlite` database. This should only be used for testing,
since the database is erased whenever the hub pod restarts - causing the hub
to lose all memory of users who had logged in before.
When using this for testing, make sure you delete all other objects that the
hub has created (such as user pods, user PVCs, etc) every time the hub restarts.
Otherwise you might run into errors about duplicate resources.
3. **mysql**
Use an externally hosted mysql database.
You have to specify an sqlalchemy connection string for the mysql database you
want to connect to in `hub.db.url` if using this option.
The general format of the connection string is:
```
mysql+pymysql://<db-username>:<db-password>@<db-hostname>:<db-port>/<db-name>
```
The user specified in the connection string must have the rights to create
tables in the database specified.
4. **postgres**
Use an externally hosted postgres database.
You have to specify an sqlalchemy connection string for the postgres database you
want to connect to in `hub.db.url` if using this option.
The general format of the connection string is:
```
postgresql+psycopg2://<db-username>:<db-password>@<db-hostname>:<db-port>/<db-name>
```
The user specified in the connection string must have the rights to create
tables in the database specified.
5. **other**
Use an externally hosted database of some kind other than mysql
or postgres.
When using _other_, the database password must be passed as
part of [hub.db.url](schema_hub.db.url) as
[hub.db.password](schema_hub.db.password) will be ignored.
pvc:
type: object
additionalProperties: false
required: [storage]
description: |
Customize the Persistent Volume Claim used when `hub.db.type` is `sqlite-pvc`.
properties:
annotations:
type: object
additionalProperties: false
patternProperties: &labels-and-annotations-patternProperties
".*":
type: string
description: |
Annotations to apply to the PVC containing the sqlite database.
See [the Kubernetes
documentation](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
for more details about annotations.
selector:
type: object
additionalProperties: true
description: |
Label selectors to set for the PVC containing the sqlite database.
Useful when you are using a specific PV, and want to bind to
that and only that.
See [the Kubernetes
documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)
for more details about using a label selector for what PV to
bind to.
storage:
type: string
description: |
Size of disk to request for the database disk.
accessModes:
type: array
items:
type: [string, "null"]
description: |
AccessModes contains the desired access modes the volume
should have. See [the k8s
documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1)
for more information.
storageClassName:
type: [string, "null"]
description: |
Name of the StorageClass required by the claim.
If this is a blank string it will be set to a blank string,
while if it is null, it will not be set at all.
subPath:
type: [string, "null"]
description: |
Path within the volume from which the container's volume
should be mounted. Defaults to "" (volume's root).
upgrade:
type: [boolean, "null"]
description: |
Users with external databases need to opt-in for upgrades of the
JupyterHub specific database schema if needed as part of a
JupyterHub version upgrade.
url:
type: [string, "null"]
description: |
Connection string when `hub.db.type` is mysql or postgres.
See documentation for `hub.db.type` for more details on the format of this property.
password:
type: [string, "null"]
description: |
Password for the database when `hub.db.type` is mysql or postgres.
labels:
type: object
additionalProperties: false
patternProperties: *labels-and-annotations-patternProperties
description: |
Extra labels to add to the hub pod.
See the [Kubernetes docs](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/)
to learn more about labels.
initContainers:
type: array
description: |
list of initContainers to be run with hub pod. See [Kubernetes Docs](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/)
```yaml
hub:
initContainers:
- name: init-myservice
image: busybox:1.28
command: ['sh', '-c', 'command1']
- name: init-mydb
image: busybox:1.28
command: ['sh', '-c', 'command2']
```
extraEnv:
type: [object, array]
additionalProperties: true
description: |
Extra environment variables that should be set for the hub pod.
Environment variables are usually used to:
- Pass parameters to some custom code in `hub.extraConfig`.
- Configure code running in the hub pod, such as an authenticator or
spawner.
String literals with `$(ENV_VAR_NAME)` will be expanded by Kubelet which
is a part of Kubernetes.
```yaml
hub:
extraEnv:
# basic notation (for literal values only)
MY_ENV_VARS_NAME1: "my env var value 1"
# explicit notation (the "name" field takes precedence)
HUB_NAMESPACE:
name: HUB_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# implicit notation (the "name" field is implied)
PREFIXED_HUB_NAMESPACE:
value: "my-prefix-$(HUB_NAMESPACE)"
SECRET_VALUE:
valueFrom:
secretKeyRef:
name: my-k8s-secret
key: password
```
For more information, see the [Kubernetes EnvVar
specification](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#envvar-v1-core).
extraConfig:
type: object
additionalProperties: true
description: |
Arbitrary extra python based configuration that should be in `jupyterhub_config.py`.
This is the *escape hatch* - if you want to configure JupyterHub to do something specific
that is not present here as an option, you can write the raw Python to do it here.
extraConfig is a *dict*, so there can be multiple configuration
snippets under different names. The configuration sections are run in
alphabetical order based on the keys.
Non-exhaustive examples of things you can do here:
- Subclass authenticator / spawner to do a custom thing
- Dynamically launch different images for different sets of images
- Inject an auth token from GitHub authenticator into user pod
- Anything else you can think of!
Since this is usually a multi-line string, you want to format it using YAML's
[| operator](https://yaml.org/spec/1.2.2/#23-scalars).
For example:
```yaml
hub:
extraConfig:
myConfig.py: |
c.JupyterHub.something = 'something'
c.Spawner.something_else = 'something else'
```
```{note}
No code validation is performed until JupyterHub loads it! If you make
a typo here, it will probably manifest itself as the hub pod failing
to start up and instead entering an `Error` state or the subsequent
`CrashLoopBackoff` state.
To make use of your own programs linters etc, it would be useful to
not embed Python code inside a YAML file. To do that, consider using
[`hub.extraFiles`](schema_hub.extraFiles) and mounting a file to
`/usr/local/etc/jupyterhub/jupyterhub_config.d` in order to load your
extra configuration logic.
```
fsGid:
type: [integer, "null"]
minimum: 0