Skip to content

Commit

Permalink
Qhub Extension (Ready for Review) (nebari-dev#886)
Browse files Browse the repository at this point in the history
* add support for helm_extensions in qhub-config.yaml file

* add helm_extensions documentation

Co-authored-by: Adam-D-Lewis <>
  • Loading branch information
Adam-D-Lewis authored Nov 5, 2021
1 parent 38faf90 commit 6008711
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/source/admin_guide/custom-helm-charts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Other Helm Charts

Arbitrary helm charts can be deployed and managed with the qhub-config.yaml file.

As an example, deploying the redis helm chart with qhub might look like the below:

```yaml
helm_extensions:
- name: my-redis-deployment
repository: https://charts.bitnami.com/bitnami
chart: redis
version: 15.5.1
overrides:
diagnosticMode:
enabled: true
```
The `overrides` section is optional, but corresponds to the helm chart's [values.yaml](https://helm.sh/docs/chart_template_guide/values_files/) file, and allows you to override the default helm chart settings.
1 change: 1 addition & 0 deletions docs/source/admin_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ system_maintenance.md
monitoring.md
clearml.md
prefect.md
custom-helm-charts.md
faq.md
```
1 change: 1 addition & 0 deletions qhub/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"h2_color": "#652e8e",
}
},
"helm_extensions": [],
"monitoring": {
"enabled": True,
},
Expand Down
10 changes: 10 additions & 0 deletions qhub/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ class CICD(Base):
after_script: typing.Optional[typing.List[str]]


# ======== Generic Helm Extensions ========
class HelmExtension(Base):
name: str
repository: str
chart: str
version: str
overrides: typing.Optional[typing.Dict]


# ============== Monitoring =============


Expand Down Expand Up @@ -419,6 +428,7 @@ class Main(Base):
TerraformModules
] # No longer used, so ignored, but could still be in qhub-config.yaml
certificate: Certificate
helm_extensions: typing.Optional[typing.List[HelmExtension]]
prefect: typing.Optional[Prefect]
cdsdashboards: CDSDashboards
security: Security
Expand Down
1 change: 1 addition & 0 deletions qhub/template/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"certificate": {
"type": "self-signed"
},
"helm_extensions": [],
"monitoring": {
"enabled": null
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,27 @@ module "qhub" {

}

{% for helm_extension in cookiecutter.helm_extensions -%}
module "{{helm_extension['name'] }}-extension" {
source = "./modules/kubernetes/services/helm-extensions"
name = "{{ helm_extension['name'] }}"
namespace = var.environment
repository = "{{ helm_extension['repository'] }}"
chart = "{{ helm_extension['chart'] }}"
chart_version = "{{ helm_extension['version'] }}"
{% if 'overrides' in helm_extension -%}
overrides = [<<EOT
{{ helm_extension['overrides']|yamlify -}}
EOT
]
{% endif -%}
depends_on = [
module.qhub
]
}

{% endfor -%}

{% if cookiecutter.prefect.enabled -%}
module "prefect" {
source = "./modules/kubernetes/services/prefect"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "helm_release" "custom-helm-deployment" {
name = var.name
namespace = var.namespace
repository = var.repository
chart = var.chart
version = var.chart_version

values = var.overrides
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "name" {
description = "helm deployment name"
type = string
default = "dev"
}

variable "namespace" {
description = "deploy helm chart on this namespace"
type = string
default = "dev"
}

variable "repository" {
description = "helm chart repository"
type = string
}

variable "chart" {
description = "helm chart name in helm chart repository"
type = string
}

variable "chart_version" {
description = "Helm chart version"
type = string
}

variable "overrides" {
description = "Overrides for the helm chart values"
type = list
default = []
}

0 comments on commit 6008711

Please sign in to comment.