Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to add overrides to jhub-apps config #2754

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/_nebari/stages/kubernetes_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class ArgoWorkflows(schema.Base):

class JHubApps(schema.Base):
enabled: bool = False
overrides: Dict = {}


class MonitoringOverrides(schema.Base):
Expand Down Expand Up @@ -473,6 +474,7 @@ class JupyterhubInputVars(schema.Base):
idle_culler_settings: Dict[str, Any] = Field(alias="idle-culler-settings")
argo_workflows_enabled: bool = Field(alias="argo-workflows-enabled")
jhub_apps_enabled: bool = Field(alias="jhub-apps-enabled")
jhub_apps_overrides: str = Field(alias="jhub-apps-overrides")
cloud_provider: str = Field(alias="cloud-provider")
jupyterlab_preferred_dir: Optional[str] = Field(alias="jupyterlab-preferred-dir")
shared_fs_type: SharedFsEnum
Expand Down Expand Up @@ -639,6 +641,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
idle_culler_settings=self.config.jupyterlab.idle_culler.model_dump(),
argo_workflows_enabled=self.config.argo_workflows.enabled,
jhub_apps_enabled=self.config.jhub_apps.enabled,
jhub_apps_overrides=json.dumps(self.config.jhub_apps.overrides),
initial_repositories=str(self.config.jupyterlab.initial_repositories),
jupyterlab_default_settings=self.config.jupyterlab.default_settings,
jupyterlab_gallery_settings=self.config.jupyterlab.gallery_settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ module "jupyterhub" {
conda-store-service-name = module.kubernetes-conda-store-server.service_name
conda-store-jhub-apps-token = module.kubernetes-conda-store-server.service-tokens.jhub-apps
jhub-apps-enabled = var.jhub-apps-enabled
jhub-apps-overrides = var.jhub-apps-overrides

extra-mounts = {
"/etc/dask" = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
import json

import kubernetes.client.models
from tornado import gen
Expand Down Expand Up @@ -65,6 +66,10 @@ def get_conda_store_environments(user_info: dict):
c.JAppsConfig.hub_host = "hub"
c.JAppsConfig.service_workers = 4

jhub_apps_overrides = json.loads(z2jh.get_config("custom.jhub-apps-overrides"))
for config_key, config_value in jhub_apps_overrides.items():
setattr(c.JAppsConfig, config_key, config_value)

def service_for_jhub_apps(name, url):
return {
"name": name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ resource "helm_release" "jupyterhub" {
conda-store-service-name = var.conda-store-service-name
conda-store-jhub-apps-token = var.conda-store-jhub-apps-token
jhub-apps-enabled = var.jhub-apps-enabled
jhub-apps-overrides = var.jhub-apps-overrides
initial-repositories = var.initial-repositories
skel-mount = {
name = kubernetes_config_map.etc-skel.metadata.0.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ variable "jhub-apps-enabled" {
type = bool
}

variable "jhub-apps-overrides" {
description = "jhub-apps configuration overrides"
type = string
}

variable "conda-store-argo-workflows-jupyter-scheduler-token" {
description = "Token for argo-workflows-jupyter-schedule to use conda-store"
type = string
Expand Down
6 changes: 6 additions & 0 deletions src/_nebari/stages/kubernetes_services/template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ variable "jhub-apps-enabled" {
type = bool
}

variable "jhub-apps-overrides" {
description = "jhub-apps configuration overrides"
type = string
default = "{}"
}

variable "cloud-provider" {
description = "Name of cloud provider."
type = string
Expand Down
Loading