From ca01d8f9f25f451d53d0de3f53c5a066a05fbd2d Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 21 Aug 2023 10:48:49 -0700 Subject: [PATCH 1/5] Do not try and add argo envs when disabled --- src/_nebari/stages/kubernetes_services/template/jupyterhub.tf | 1 + .../services/jupyterhub/files/jupyterhub/03-profiles.py | 3 +++ .../template/modules/kubernetes/services/jupyterhub/main.tf | 1 + 3 files changed, 5 insertions(+) diff --git a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf index abb76a3a72..c7ed36668e 100644 --- a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf +++ b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf @@ -105,6 +105,7 @@ module "jupyterhub" { conda-store-mount = "/home/conda" conda-store-environments = var.conda-store-environments default-conda-store-namespace = var.conda-store-default-namespace + argo-workflows-enabled = module.argo-workflows.argo-workflows-enabled conda-store-cdsdashboard-token = module.kubernetes-conda-store-server.service-tokens.cdsdashboards conda-store-argo-workflows-jupyter-scheduler-token = module.kubernetes-conda-store-server.service-tokens.argo-workflows-jupyter-scheduler conda-store-service-name = module.kubernetes-conda-store-server.service_name diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/03-profiles.py b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/03-profiles.py index ad8ed50899..d7e3e554ba 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/03-profiles.py +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/files/jupyterhub/03-profiles.py @@ -314,6 +314,9 @@ def configure_user(username, groups, uid=1000, gid=100): def profile_argo_token(groups): # TODO: create a more robust check user's Argo-Workflow role + if not z2jh.get_config("custom.argo-workflows-enabled"): + return {} + domain = z2jh.get_config("custom.external-url") namespace = z2jh.get_config("custom.namespace") 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 ef2bfb9c50..da84f0606a 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 @@ -29,6 +29,7 @@ resource "helm_release" "jupyterhub" { theme = var.theme profiles = var.profiles cdsdashboards = var.cdsdashboards + argo-workflows-enabled = var.argo-workflows-enabled home-pvc = var.home-pvc shared-pvc = var.shared-pvc conda-store-pvc = var.conda-store-pvc From 87e0761f15768bbb1345f8ce387d92be7926978d Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 21 Aug 2023 11:38:38 -0700 Subject: [PATCH 2/5] Grab argo_workflow_enabled var from config --- src/_nebari/stages/kubernetes_services/__init__.py | 2 ++ .../stages/kubernetes_services/template/jupyterhub.tf | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/_nebari/stages/kubernetes_services/__init__.py b/src/_nebari/stages/kubernetes_services/__init__.py index 087bac4642..aecf541792 100644 --- a/src/_nebari/stages/kubernetes_services/__init__.py +++ b/src/_nebari/stages/kubernetes_services/__init__.py @@ -380,6 +380,7 @@ class JupyterhubInputVars(schema.Base): jupyterhub_image: ImageNameTag = Field(alias="jupyterhub-image") jupyterhub_hub_extraEnv: str = Field(alias="jupyterhub-hub-extraEnv") idle_culler_settings: Dict[str, Any] = Field(alias="idle-culler-settings") + argo_workflows_enabled: bool = Field(alias="argo-workflows-enabled") class DaskGatewayInputVars(schema.Base): @@ -524,6 +525,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]): self.config.jupyterhub.overrides.get("hub", {}).get("extraEnv", []) ), idle_culler_settings=self.config.jupyterlab.idle_culler.dict(), + argo_workflows_enabled=self.config.argo_workflows.enabled, ) dask_gateway_vars = DaskGatewayInputVars( diff --git a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf index c7ed36668e..123e61e965 100644 --- a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf +++ b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf @@ -59,6 +59,11 @@ variable "idle-culler-settings" { type = any } +variable "argo-workflows-enabled" { + description = "Enable Argo Workflows" + type = bool +} + module "kubernetes-nfs-server" { count = var.jupyterhub-shared-endpoint == null ? 1 : 0 @@ -105,7 +110,7 @@ module "jupyterhub" { conda-store-mount = "/home/conda" conda-store-environments = var.conda-store-environments default-conda-store-namespace = var.conda-store-default-namespace - argo-workflows-enabled = module.argo-workflows.argo-workflows-enabled + argo-workflows-enabled = var.argo-workflows-enabled conda-store-cdsdashboard-token = module.kubernetes-conda-store-server.service-tokens.cdsdashboards conda-store-argo-workflows-jupyter-scheduler-token = module.kubernetes-conda-store-server.service-tokens.argo-workflows-jupyter-scheduler conda-store-service-name = module.kubernetes-conda-store-server.service_name From 10d607af69d557bfa13a3edce03b1b738172e38c Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 21 Aug 2023 12:42:19 -0700 Subject: [PATCH 3/5] Move argo_workflows_enabled var --- .../stages/kubernetes_services/template/argo-workflows.tf | 5 ----- .../stages/kubernetes_services/template/jupyterhub.tf | 5 ----- .../stages/kubernetes_services/template/variables.tf | 6 ++++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/_nebari/stages/kubernetes_services/template/argo-workflows.tf b/src/_nebari/stages/kubernetes_services/template/argo-workflows.tf index ade8c2c3ce..ecf1008fbf 100644 --- a/src/_nebari/stages/kubernetes_services/template/argo-workflows.tf +++ b/src/_nebari/stages/kubernetes_services/template/argo-workflows.tf @@ -1,9 +1,4 @@ # ======================= VARIABLES ====================== -variable "argo-workflows-enabled" { - description = "Argo Workflows enabled" - type = bool -} - variable "argo-workflows-overrides" { description = "Argo Workflows helm chart overrides" type = list(string) diff --git a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf index 123e61e965..eb18998aec 100644 --- a/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf +++ b/src/_nebari/stages/kubernetes_services/template/jupyterhub.tf @@ -59,11 +59,6 @@ variable "idle-culler-settings" { type = any } -variable "argo-workflows-enabled" { - description = "Enable Argo Workflows" - type = bool -} - 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 63c6c5b4f8..7b3394c01d 100644 --- a/src/_nebari/stages/kubernetes_services/template/variables.tf +++ b/src/_nebari/stages/kubernetes_services/template/variables.tf @@ -38,3 +38,9 @@ variable "conda-store-default-namespace" { description = "Default conda-store namespace name" type = string } + + +variable "argo-workflows-enabled" { + description = "Enable Argo Workflows" + type = bool +} From bc7e282b26fffe01e8ea7ac804413e0b9c4feaf5 Mon Sep 17 00:00:00 2001 From: iameskild Date: Mon, 21 Aug 2023 13:59:01 -0700 Subject: [PATCH 4/5] Add var --- .../modules/kubernetes/services/jupyterhub/variables.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/variables.tf b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/variables.tf index 8c0af0b77c..291c55b50b 100644 --- a/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/variables.tf +++ b/src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/variables.tf @@ -162,3 +162,8 @@ variable "idle-culler-settings" { terminal_cull_interval = number }) } + +variable "argo-workflows-enabled" { + description = "Enable Argo Workflows" + type = bool +} From c088c99ac463e101b48980214d64a057935cde0e Mon Sep 17 00:00:00 2001 From: iameskild Date: Tue, 29 Aug 2023 08:37:09 -0700 Subject: [PATCH 5/5] Remove CDS, fix from merge conflict --- .../template/modules/kubernetes/services/jupyterhub/main.tf | 1 - 1 file changed, 1 deletion(-) 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 e35fae92a4..3c5822a461 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 @@ -28,7 +28,6 @@ resource "helm_release" "jupyterhub" { external-url = var.external-url theme = var.theme profiles = var.profiles - cdsdashboards = var.cdsdashboards argo-workflows-enabled = var.argo-workflows-enabled home-pvc = var.home-pvc shared-pvc = var.shared-pvc