From 0f4480803f5952237cf454524ec2766829cdc64b Mon Sep 17 00:00:00 2001 From: annekebr <44376590+annekebr@users.noreply.github.com> Date: Fri, 26 Nov 2021 11:04:21 +0100 Subject: [PATCH] docs: add jsonschema for values.yaml Adding a jsonschema allows user to fail early as the user configuration in the is validated at installation time already. For that reason, there has been added additional validation that couldn't be performed using jsonschema in the helm helper file. Moreover, as we now have our dear conny in artifacthub we can enhance our artifacthub page by adding a jsonschema as artifacthub parses the file and shows its content in a nice format. --- .github/PULL_REQUEST_TEMPLATE.md | 1 + helm/templates/_helpers.tpl | 68 ++ helm/templates/alertconfig.yaml | 4 +- helm/templates/config.yaml | 2 + helm/values.schema.json | 1710 ++++++++++++++++++++++++++++++ 5 files changed, 1784 insertions(+), 1 deletion(-) create mode 100644 helm/values.schema.json diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2394c60b4..351265365 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,5 +14,6 @@ Fixes # - [ ] PR follows [Contributing Guide](../docs/CONTRIBUTING.md) - [ ] Added tests (if necessary) - [ ] Extended README/Documentation (if necessary) +- [ ] Adjusted `helm/values.schema.json` according to new changes if `helm/values.yaml` has been touched - [ ] Adjusted versions of image and Helm chart in `values.yaml` and `Chart.yaml` (if necessary) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index 06f2c19bf..aaea644d0 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -184,3 +184,71 @@ Extract Kubernetes Minor Version. readOnly: true {{- end -}} {{- end -}} +{{- define "checkForAlertTemplates" -}} + {{ $files := .Files }} + {{- if .Values.alerting }} + {{- if .Values.alerting.admit_request }} + {{- if .Values.alerting.admit_request.templates }} + {{- range .Values.alerting.admit_request.templates }} + {{- $filename := .template -}} + {{- $file := printf "alert_payload_templates/%s.json" $filename | $files.Get }} + {{- if $file }} + {{- else }} + {{- fail (printf "The value of the alert template must be chosen such that