diff --git a/README.md b/README.md index f28970d..47c9ba3 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,27 @@ secret: ``` +## Extra objects +You can add extra objects to the deployment, like configmaps, secrets, etc. by adding them to the `extraObjects` section in the `values.yaml` file so no additional deployment/pipeline is needed. + +```yaml +# values.yaml +extraObjects: + - apiVersion: v1 + kind: ConfigMap + metadata: + name: "extra" + data: + something: "extra" + - | + apiVersion: v1 + kind: ConfigMap + metadata: + name: "templated" + data: + something: {{ printf "templated" }} +``` + ## Setup ```shell diff --git a/charts/n8n/Chart.yaml b/charts/n8n/Chart.yaml index 29ab842..f27b094 100644 --- a/charts/n8n/Chart.yaml +++ b/charts/n8n/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: n8n -version: 0.25.2 +version: 0.26.0 appVersion: 1.62.5 type: application description: "A Kubernetes Helm chart for n8n a free and open fair-code licensed node based Workflow Automation Tool. Easily automate tasks across different services." diff --git a/charts/n8n/templates/_helpers.tpl b/charts/n8n/templates/_helpers.tpl index 2b2cf48..8c6c42a 100644 --- a/charts/n8n/templates/_helpers.tpl +++ b/charts/n8n/templates/_helpers.tpl @@ -139,3 +139,18 @@ Create the name of the service account to use claimName: {{ include "n8n.fullname" . }} {{- end }} {{- end }} + +{{/* Renders a complete tree, even values that contains template. */}} +{{- define "n8n.render" -}} + {{- if not .value -}} + {{- fail "Value cannot be empty" -}} + {{- end -}} + {{- if not .context -}} + {{- fail "Context cannot be empty" -}} + {{- end -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{ else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/n8n/templates/extra.objects.yaml b/charts/n8n/templates/extra.objects.yaml new file mode 100644 index 0000000..1e0cb15 --- /dev/null +++ b/charts/n8n/templates/extra.objects.yaml @@ -0,0 +1,4 @@ +{{- range .Values.extraObjects }} +--- +{{ include "n8n.render" (dict "value" . "context" $) }} +{{- end }} \ No newline at end of file diff --git a/charts/n8n/values.yaml b/charts/n8n/values.yaml index 849ba2c..b709845 100644 --- a/charts/n8n/values.yaml +++ b/charts/n8n/values.yaml @@ -330,3 +330,8 @@ redis: enabled: true existingClaim: "" size: 2Gi + + +# Extra objects to deploy (value evaluated as a template) +# In some cases, it can avoid the need for additional, extended or adhoc deployments. +extraObjects: []