Skip to content

Commit 6d9abb0

Browse files
authored
Add ability to add overrides to jhub-apps config (#2754)
2 parents 42e0b15 + 8557240 commit 6d9abb0

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

src/_nebari/stages/kubernetes_services/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ class ArgoWorkflows(schema.Base):
218218

219219
class JHubApps(schema.Base):
220220
enabled: bool = False
221+
overrides: Dict = {}
221222

222223

223224
class MonitoringOverrides(schema.Base):
@@ -473,6 +474,7 @@ class JupyterhubInputVars(schema.Base):
473474
idle_culler_settings: Dict[str, Any] = Field(alias="idle-culler-settings")
474475
argo_workflows_enabled: bool = Field(alias="argo-workflows-enabled")
475476
jhub_apps_enabled: bool = Field(alias="jhub-apps-enabled")
477+
jhub_apps_overrides: str = Field(alias="jhub-apps-overrides")
476478
cloud_provider: str = Field(alias="cloud-provider")
477479
jupyterlab_preferred_dir: Optional[str] = Field(alias="jupyterlab-preferred-dir")
478480
shared_fs_type: SharedFsEnum
@@ -639,6 +641,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
639641
idle_culler_settings=self.config.jupyterlab.idle_culler.model_dump(),
640642
argo_workflows_enabled=self.config.argo_workflows.enabled,
641643
jhub_apps_enabled=self.config.jhub_apps.enabled,
644+
jhub_apps_overrides=json.dumps(self.config.jhub_apps.overrides),
642645
initial_repositories=str(self.config.jupyterlab.initial_repositories),
643646
jupyterlab_default_settings=self.config.jupyterlab.default_settings,
644647
jupyterlab_gallery_settings=self.config.jupyterlab.gallery_settings,

src/_nebari/stages/kubernetes_services/template/jupyterhub.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ module "jupyterhub" {
180180
conda-store-service-name = module.kubernetes-conda-store-server.service_name
181181
conda-store-jhub-apps-token = module.kubernetes-conda-store-server.service-tokens.jhub-apps
182182
jhub-apps-enabled = var.jhub-apps-enabled
183+
jhub-apps-overrides = var.jhub-apps-overrides
183184

184185
extra-mounts = {
185186
"/etc/dask" = {

src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/02-spawner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import inspect
2+
import json
23

34
import kubernetes.client.models
45
from tornado import gen
@@ -65,6 +66,10 @@ def get_conda_store_environments(user_info: dict):
6566
c.JAppsConfig.hub_host = "hub"
6667
c.JAppsConfig.service_workers = 4
6768

69+
jhub_apps_overrides = json.loads(z2jh.get_config("custom.jhub-apps-overrides"))
70+
for config_key, config_value in jhub_apps_overrides.items():
71+
setattr(c.JAppsConfig, config_key, config_value)
72+
6873
def service_for_jhub_apps(name, url):
6974
return {
7075
"name": name,

src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ resource "helm_release" "jupyterhub" {
7777
conda-store-service-name = var.conda-store-service-name
7878
conda-store-jhub-apps-token = var.conda-store-jhub-apps-token
7979
jhub-apps-enabled = var.jhub-apps-enabled
80+
jhub-apps-overrides = var.jhub-apps-overrides
8081
initial-repositories = var.initial-repositories
8182
skel-mount = {
8283
name = kubernetes_config_map.etc-skel.metadata.0.name

src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ variable "jhub-apps-enabled" {
124124
type = bool
125125
}
126126

127+
variable "jhub-apps-overrides" {
128+
description = "jhub-apps configuration overrides"
129+
type = string
130+
}
131+
127132
variable "conda-store-argo-workflows-jupyter-scheduler-token" {
128133
description = "Token for argo-workflows-jupyter-schedule to use conda-store"
129134
type = string

src/_nebari/stages/kubernetes_services/template/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ variable "jhub-apps-enabled" {
5959
type = bool
6060
}
6161

62+
variable "jhub-apps-overrides" {
63+
description = "jhub-apps configuration overrides"
64+
type = string
65+
default = "{}"
66+
}
67+
6268
variable "cloud-provider" {
6369
description = "Name of cloud provider."
6470
type = string

0 commit comments

Comments
 (0)