diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/configmaps.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/configmaps.tf index bfee219e9..9581af48a 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/configmaps.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/configmaps.tf @@ -60,6 +60,17 @@ resource "local_file" "overrides_json" { filename = "${path.module}/files/jupyterlab/overrides.json" } +resource "local_file" "page_config_json" { + content = jsonencode({ + "disabledExtensions" : { + "jupyterlab-jhub-apps:" : !var.jhub-apps-enabled + }, + # `lockedExtensions` is an empty dict to signify that `jupyterlab-jhub-apps` is not being disabled and locked (but only disabled) + # which means users are still allowed to disable the jupyterlab-jhub-apps extension (if they have write access to page_config). + "lockedExtensions" : {} + }) + filename = "${path.module}/files/jupyterlab/page_config.json" +} resource "kubernetes_config_map" "etc-ipython" { metadata { @@ -92,6 +103,9 @@ locals { etc-jupyterlab-settings = { "overrides.json" = local_file.overrides_json.content } + etc-jupyterlab-page-config = { + "page_config.json" = local_file.page_config_json.content + } } resource "kubernetes_config_map" "etc-jupyter" { @@ -136,6 +150,20 @@ resource "kubernetes_config_map" "jupyterlab-settings" { data = local.etc-jupyterlab-settings } + +resource "kubernetes_config_map" "jupyterlab-page-config" { + depends_on = [ + local_file.page_config_json + ] + + metadata { + name = "jupyterlab-page-config" + namespace = var.namespace + } + + data = local.etc-jupyterlab-page-config +} + resource "kubernetes_config_map" "git_clone_update" { metadata { name = "git-clone-update" diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf index a36090f41..4de73c75d 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf @@ -104,6 +104,11 @@ resource "helm_release" "jupyterhub" { kind = "configmap" } + "/opt/conda/envs/default/etc/jupyter/labconfig/page_config.json" = { + name = kubernetes_config_map.jupyterlab-page-config.metadata.0.name + namespace = kubernetes_config_map.jupyterlab-page-config.metadata.0.namespace + kind = "configmap" + } } ) environments = var.conda-store-environments