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

feat: Add support for extra objects #136

Closed
wants to merge 5 commits into from
Closed
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
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/n8n/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
15 changes: 15 additions & 0 deletions charts/n8n/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
4 changes: 4 additions & 0 deletions charts/n8n/templates/extra.objects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraObjects }}
---
{{ include "n8n.render" (dict "value" . "context" $) }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/n8n/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []