Skip to content

Commit

Permalink
Disable jupyterlab-jhub-apps extension when jhub-apps is disabled (…
Browse files Browse the repository at this point in the history
…if installed)
  • Loading branch information
krassowski committed Oct 29, 2024
1 parent 55094c3 commit d1572eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1572eb

Please sign in to comment.