diff --git a/src/_nebari/stages/kubernetes_daskgateway/__init__.py b/src/_nebari/stages/kubernetes_daskgateway/__init__.py new file mode 100644 index 000000000..0a2fa501e --- /dev/null +++ b/src/_nebari/stages/kubernetes_daskgateway/__init__.py @@ -0,0 +1,45 @@ +import contextlib +from typing import Any, Dict, List, Type + +from _nebari.stages.base import NebariKustomizeStage +from nebari import schema +from nebari.hookspecs import NebariStage, hookimpl + + +class InputSchema(schema.Base): + pass + + +class OutputSchema(schema.Base): + pass + + +class DaskGatewayStage(NebariKustomizeStage): + name = "10-kubernetes-daskgateway" + priority = 100 + + input_schema = InputSchema + output_schema = OutputSchema + + @property + def kustomize_vars(self): + return { + "namespace": self.config.namespace, + "daskgateway_helm_version": self.config.monitoring.healthchecks.daskgateway_helm_version, + } + + @contextlib.contextmanager + def deploy( + self, stage_outputs: Dict[str, Dict[str, Any]], disable_prompt: bool = False + ): + if self.config.monitoring.healthchecks.enabled: + with super().deploy(stage_outputs, disable_prompt): + yield + else: + with self.destroy(stage_outputs, {}): + yield + + +@hookimpl +def nebari_stage() -> List[Type[NebariStage]]: + return [DaskGatewayStage] diff --git a/src/_nebari/stages/kubernetes_daskgateway/template/kustomization.yaml.tmpl b/src/_nebari/stages/kubernetes_daskgateway/template/kustomization.yaml.tmpl new file mode 100644 index 000000000..a43afec50 --- /dev/null +++ b/src/_nebari/stages/kubernetes_daskgateway/template/kustomization.yaml.tmpl @@ -0,0 +1,11 @@ +# kustomization.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +helmCharts: +- name: daskgateway + repo: https://helm.dask.org/ + releaseName: daskgateway + namespace: {{ namespace }} + version: "{{ daskgateway_helm_version }}" + valuesFile: values.yaml diff --git a/src/_nebari/stages/kubernetes_daskgateway/template/values.yaml b/src/_nebari/stages/kubernetes_daskgateway/template/values.yaml new file mode 100644 index 000000000..435ddea0d --- /dev/null +++ b/src/_nebari/stages/kubernetes_daskgateway/template/values.yaml @@ -0,0 +1,29 @@ +metadata: + name: ${var.name}-daskgateway-gateway + namespace: var.namespace + +spec: + replicas: 1 + selector: + match_labels: + app.kubernetes.io/component: dask-gateway-gateway + + template: + metadata: + + labels: + app.kubernetes.io/component: dask-gateway-gateway + + annotations: + checksum/config-map: sha256(jsonencode(kubernetes_config_map.gateway.data)) + checksum/secret: sha256(jsonencode(kubernetes_secret.gateway.data)) + + spec: + affinity: + node_affinity: + required_during_scheduling_ignored_during_execution: + node_selector_term: + match_expressions: + key: var.general-node-group.key + operator: In + values: var.general-node-group.value