diff --git a/qhub/template/stages/07-kubernetes-services/jupyterhub.tf b/qhub/template/stages/07-kubernetes-services/jupyterhub.tf index e4b43ab85..9f1dcfcd9 100644 --- a/qhub/template/stages/07-kubernetes-services/jupyterhub.tf +++ b/qhub/template/stages/07-kubernetes-services/jupyterhub.tf @@ -92,6 +92,7 @@ module "jupyterhub" { conda-store-pvc = module.conda-store-nfs-mount.persistent_volume_claim.name conda-store-mount = "/home/conda" + conda-store-environments = var.conda-store-environments extra-mounts = { "/etc/dask" = { diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/02-spawner.py b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/02-spawner.py index 318ec1fbb..5ab464c99 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/02-spawner.py +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/files/02-spawner.py @@ -8,6 +8,7 @@ import z2jh cdsdashboards = z2jh.get_config("custom.cdsdashboards") +conda_store_environments = z2jh.get_config("custom.environments") if cdsdashboards["enabled"]: from cdsdashboards.hubextension.spawners.variablekube import VariableKubeSpawner @@ -31,9 +32,7 @@ c.CDSDashboardsConfig.spawn_default_options = False c.CDSDashboardsConfig.conda_envs = [ - # {%- for key in cookiecutter.environments %} - # "{{ cookiecutter.environments[key].name }}", - # {%- endfor %} + environment['name'] for _, environment in conda_store_environments.items() ] else: c.JupyterHub.allow_named_servers = False diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/main.tf b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/main.tf index f0afd3151..efed37b25 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/main.tf +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/main.tf @@ -31,6 +31,7 @@ resource "helm_release" "jupyterhub" { conda-store-pvc = var.conda-store-pvc conda-store-mount = var.conda-store-mount extra-mounts = var.extra-mounts + environments = var.conda-store-environments } hub = { diff --git a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/variables.tf b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/variables.tf index 425772b33..68a578081 100644 --- a/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/variables.tf +++ b/qhub/template/stages/07-kubernetes-services/modules/kubernetes/services/jupyterhub/variables.tf @@ -110,3 +110,9 @@ variable "cdsdashboards" { cds_hide_user_dashboard_servers = false } } + +variable "conda-store-environments" { + description = "conda environments from conda-store in filesystem namespace" + type = map(any) + default = {} +}