Skip to content

Commit 2285a5e

Browse files
authored
feat: add ability to deploy extra k8s yamls with helm chart (#5942)
1 parent a750b19 commit 2285a5e

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

helm/templates/_helpers.tpl

+13
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,16 @@ Deprecated value coder.tls.secretName must not be used.
177177
{{ fail "coder.tls.secretName is deprecated, use coder.tls.secretNames instead." }}
178178
{{- end }}
179179
{{- end }}
180+
181+
{{/*
182+
Renders a value that contains a template.
183+
Usage:
184+
{{ include "coder.renderTemplate" ( dict "value" .Values.path.to.the.Value "context" $) }}
185+
*/}}
186+
{{- define "coder.renderTemplate" -}}
187+
{{- if typeIs "string" .value }}
188+
{{- tpl .value .context }}
189+
{{- else }}
190+
{{- tpl (.value | toYaml) .context }}
191+
{{- end }}
192+
{{- end -}}

helm/templates/extra-templates.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{- range .Values.extraTemplates }}
2+
---
3+
{{ include "coder.renderTemplate" (dict "value" . "context" $) }}
4+
{{- end }}

helm/values.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,15 @@ coder:
198198
# coder.ingress.tls.wildcardSecretName -- The name of the TLS secret to
199199
# use for the wildcard host.
200200
wildcardSecretName: ""
201+
202+
# extraTemplates -- Array of extra objects to deploy with the release. Strings
203+
# are evaluated as a template and can use template expansions and functions. All
204+
# other objects are used as yaml.
205+
extraTemplates:
206+
#- |
207+
# apiVersion: v1
208+
# kind: ConfigMap
209+
# metadata:
210+
# name: my-configmap
211+
# data:
212+
# key: {{ .Values.myCustomValue | quote }}

0 commit comments

Comments
 (0)