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 1 commit
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
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,26 @@ 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: my-configmap
data:
key: value
- apiVersion: v1
kind: Secret
metadata:
name: my-secret
data:
key: value
```

## Setup

```shell
Expand Down
9 changes: 9 additions & 0 deletions charts/n8n/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,12 @@ 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 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 }}
14 changes: 14 additions & 0 deletions charts/n8n/templates/tests/extra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extraObjects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: "extra"
data:
something: "extra"
- |
apiVersion: v1
kind: ConfigMap
metadata:
name: "templated"
data:
something: {{ printf "templated" }}
6 changes: 6 additions & 0 deletions charts/n8n/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,9 @@ 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.
# Example can be found in charts/n8n/templates/tests/extra.yaml
extraObjects: []
Loading