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

Qhub Extension #886

Merged
merged 8 commits into from
Nov 5, 2021
Merged
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
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 @@ -58,6 +58,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]
Adam-D-Lewis marked this conversation as resolved.
Show resolved Hide resolved


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


Expand Down Expand Up @@ -406,6 +415,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 @@ -222,6 +222,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 = []
}