From 642c8948e01b2b12286a61cc0f05380a84ed048f Mon Sep 17 00:00:00 2001 From: Marcelo Villa Date: Tue, 20 Feb 2024 12:18:10 -0500 Subject: [PATCH 1/2] Pass cloud provider to the dask gateway config.json file and fix access to it when determining the default node group. --- src/_nebari/stages/kubernetes_services/__init__.py | 2 ++ .../stages/kubernetes_services/template/dask_gateway.tf | 7 +++++++ .../services/dask-gateway/files/gateway_config.py | 7 ++----- .../modules/kubernetes/services/dask-gateway/gateway.tf | 1 + .../modules/kubernetes/services/dask-gateway/variables.tf | 5 +++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/_nebari/stages/kubernetes_services/__init__.py b/src/_nebari/stages/kubernetes_services/__init__.py index 6e2f1c0e9f..0702a27c52 100644 --- a/src/_nebari/stages/kubernetes_services/__init__.py +++ b/src/_nebari/stages/kubernetes_services/__init__.py @@ -376,6 +376,7 @@ class JupyterhubInputVars(schema.Base): class DaskGatewayInputVars(schema.Base): dask_worker_image: ImageNameTag = Field(alias="dask-worker-image") dask_gateway_profiles: Dict[str, Any] = Field(alias="dask-gateway-profiles") + cloud_provider: str = Field(alias="cloud-provider") class MonitoringInputVars(schema.Base): @@ -518,6 +519,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]): self.config.default_images.dask_worker ), dask_gateway_profiles=self.config.profiles.dict()["dask_worker"], + cloud_provider=cloud_provider, ) monitoring_vars = MonitoringInputVars( diff --git a/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf b/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf index 765be2753a..cb35bf60c8 100644 --- a/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf +++ b/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf @@ -11,6 +11,11 @@ variable "dask-gateway-profiles" { description = "Dask Gateway profiles to expose to user" } +variable "cloud-provider" { + description = "Name of cloud provider." + type = string +} + # =================== RESOURCES ===================== module "dask-gateway" { @@ -39,4 +44,6 @@ module "dask-gateway" { # profiles profiles = var.dask-gateway-profiles + + cloud-provider = var.cloud-provider } diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/files/gateway_config.py b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/files/gateway_config.py index 12416e2527..2219d14e56 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/files/gateway_config.py +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/files/gateway_config.py @@ -115,12 +115,9 @@ def list_dask_environments(): def base_node_group(options): key = config["worker-node-group"]["key"] - if config.provider.value == "aws": + if config.get("provider", "") == "aws": key = "dedicated" - default_node_group = { - key: config["worker-node-group"]["value"], - # config["worker-node-group"]["key"]: config["worker-node-group"]["value"], - } + default_node_group = {key: config["worker-node-group"]["value"]} # check `worker_extra_pod_config` first worker_node_group = ( diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/gateway.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/gateway.tf index eb99f75d54..62265b350b 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/gateway.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/gateway.tf @@ -24,6 +24,7 @@ resource "kubernetes_secret" "gateway" { conda-store-api-token = var.conda-store-api-token conda-store-service-name = var.conda-store-service-name conda-store-namespace = var.namespace + provider = var.cloud-provider }) } } diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/variables.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/variables.tf index 5feb72d167..7f8a4aa978 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/variables.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/dask-gateway/variables.tf @@ -199,3 +199,8 @@ variable "conda-store-service-name" { description = "internal service-name:port where conda-store can be reached" type = string } + +variable "cloud-provider" { + description = "Name of the cloud provider to deploy to." + type = string +} From 8f7d933da6b9aaf1f71daa58d67525e4d5592282 Mon Sep 17 00:00:00 2001 From: Marcelo Villa Date: Tue, 20 Feb 2024 12:29:25 -0500 Subject: [PATCH 2/2] Move duplicate variable to variables.tf --- .../stages/kubernetes_services/template/dask_gateway.tf | 6 ------ .../stages/kubernetes_services/template/jupyterhub.tf | 5 ----- .../stages/kubernetes_services/template/variables.tf | 6 ++++++ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf b/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf index cb35bf60c8..b9b0a9c6c3 100644 --- a/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf +++ b/src/_nebari/stages/kubernetes_services/template/dask_gateway.tf @@ -11,12 +11,6 @@ variable "dask-gateway-profiles" { description = "Dask Gateway profiles to expose to user" } -variable "cloud-provider" { - description = "Name of cloud provider." - type = string -} - - # =================== RESOURCES ===================== module "dask-gateway" { source = "./modules/kubernetes/services/dask-gateway" diff --git a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf index 481ebc74cd..4f8bebb9e4 100644 --- a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf +++ b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf @@ -65,11 +65,6 @@ variable "idle-culler-settings" { type = any } -variable "cloud-provider" { - description = "Name of cloud provider." - type = string -} - module "kubernetes-nfs-server" { count = var.jupyterhub-shared-endpoint == null ? 1 : 0 diff --git a/src/_nebari/stages/kubernetes_services/template/variables.tf b/src/_nebari/stages/kubernetes_services/template/variables.tf index 7a125f1c69..4b78f5994e 100644 --- a/src/_nebari/stages/kubernetes_services/template/variables.tf +++ b/src/_nebari/stages/kubernetes_services/template/variables.tf @@ -53,7 +53,13 @@ variable "jupyterlab-pioneer-log-format" { description = "Logging format for JupyterLab Pioneer" type = string } + variable "jhub-apps-enabled" { description = "Enable JupyterHub Apps" type = bool } + +variable "cloud-provider" { + description = "Name of cloud provider." + type = string +}