-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(charts): make configMap.fromFolder more like secret.fromFolder.
- Loading branch information
1 parent
c17fe69
commit 8f11206
Showing
1 changed file
with
4 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,19 @@ | ||
{{/* | ||
Builds a config map from all the files in a folder. Files can be templated. | ||
@parap .root The caller's root scope | ||
@parap .context The caller's context | ||
@param .name The name for the created config map | ||
@param .folder The folder to scan to create the config map | ||
*/}} | ||
{{- define "common.configMapFromFolder" -}} | ||
{{- define "common.configMap.fromFolder" -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .name }} | ||
namespace: {{ .root.Release.Namespace }} | ||
data: | ||
{{- range $path, $_ := (.root.Files.Glob (printf "%s/*" .folder)) }} | ||
{{ trimPrefix (printf "%s/" $.folder) $path }}: | | ||
{{- tpl ($.root.Files.Get $path) $.root | nindent 4 }} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Builds a secret from all the files in a folder. Files can be templated. | ||
@parap .context The caller's context | ||
@param .name The name for the created secret | ||
@param .folder The folder to scan to create the secret | ||
*/}} | ||
{{- define "common.secretFromFolder" -}} | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
name: {{ .name }} | ||
namespace: {{ .context.Release.Namespace }} | ||
data: | ||
{{- range $path, $_ := (.context.Files.Glob (printf "%s/*" .folder)) }} | ||
{{ trimPrefix (printf "%s/" $.folder) $path }}: | | ||
{{- tpl ($.context.Files.Get $path) $.context | b64enc | nindent 4 }} | ||
{{- tpl ($.context.Files.Get $path) $.context | nindent 4 }} | ||
{{- end }} | ||
{{- end -}} | ||
|