Skip to content

Commit a5f7a50

Browse files
committed
Add flag to control enabling prepuller
1 parent 5a5c6bd commit a5f7a50

File tree

3 files changed

+35
-20
lines changed

3 files changed

+35
-20
lines changed

src/ol_infrastructure/applications/jupyterhub/Pulumi.applications.jupyterhub.CI.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config:
1313
menu_override_file: menu_override.json
1414
disabled_extension_file: disabled_extensions.json
1515
extra_config_file: dynamicImageConfig.py
16+
enable_image_prepuller: true
1617
- name: jupyterhub-authoring
1718
domain: authoring.nb.ci.learn.mit.edu
1819
namespace: jupyterhub-authoring
@@ -23,6 +24,7 @@ config:
2324
menu_override_file: author_menu_override.json
2425
disabled_extension_file: author_disabled_extensions.json
2526
extra_config_file: dynamicImageConfig.py
27+
enable_image_prepuller: false
2628
jupyterhub:target_vpc: "applications_vpc"
2729
jupyterhub:business_unit: "mit-learn"
2830
aws:region: us-east-1

src/ol_infrastructure/applications/jupyterhub/deployment.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
from bridge.lib.magic_numbers import DEFAULT_POSTGRES_PORT
1212
from bridge.lib.versions import JUPYTERHUB_CHART_VERSION
13+
from ol_infrastructure.applications.jupyterhub.values import (
14+
get_prepuller_config_with_images,
15+
)
1316
from ol_infrastructure.components.aws.database import OLAmazonDB, OLPostgresDBConfig
1417
from ol_infrastructure.components.services.cert_manager import (
1518
OLCertManagerCert,
@@ -50,7 +53,6 @@ def provision_jupyterhub_deployment( # noqa: PLR0913
5053
disabled_extensions_json: str | None = None,
5154
extra_config: str | None = None,
5255
) -> kubernetes.helm.v3.Release:
53-
5456
base_name = jupyterhub_deployment_config["name"]
5557
domain_name = jupyterhub_deployment_config["domain"]
5658
namespace = jupyterhub_deployment_config["namespace"]
@@ -221,6 +223,7 @@ def provision_jupyterhub_deployment( # noqa: PLR0913
221223
extra_images_list = extra_images or {}
222224
admin_users_list = jupyterhub_deployment_config.get("admin_users", [])
223225
allowed_users_list = jupyterhub_deployment_config.get("allowed_users", [])
226+
enable_prepuller = jupyterhub_deployment_config.get("enable_prepuller", True)
224227
return kubernetes.helm.v3.Release(
225228
f"{base_name}-{env_name.upper()}-application-helm-release",
226229
kubernetes.helm.v3.ReleaseArgs(
@@ -330,25 +333,10 @@ def provision_jupyterhub_deployment( # noqa: PLR0913
330333
},
331334
},
332335
},
333-
"prePuller": {
334-
"continuous": {
335-
"enabled": True,
336-
},
337-
"hook": {
338-
"enabled": False,
339-
},
340-
"extraImages": extra_images_list,
341-
"resources": {
342-
"requests": {
343-
"cpu": "10m",
344-
"memory": "128Mi",
345-
},
346-
"limits": {
347-
"cpu": "100m",
348-
"memory": "512Mi",
349-
},
350-
},
351-
},
336+
# Consider keying off extra_images, it's only used for this
337+
"prePuller": get_prepuller_config_with_images(extra_images_list)
338+
if enable_prepuller
339+
else {},
352340
"singleuser": {
353341
"extraFiles": {
354342
"menu_override": {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
PREPULLER_CONFIG = {
2+
"continuous": {
3+
"enabled": True,
4+
},
5+
"hook": {
6+
"enabled": False,
7+
},
8+
"extraImages": {},
9+
"resources": {
10+
"requests": {
11+
"cpu": "10m",
12+
"memory": "128Mi",
13+
},
14+
"limits": {
15+
"cpu": "100m",
16+
"memory": "512Mi",
17+
},
18+
},
19+
}
20+
21+
22+
def get_prepuller_config_with_images(images):
23+
config = PREPULLER_CONFIG.copy()
24+
config["extraImages"] = images
25+
return config

0 commit comments

Comments
 (0)