Skip to content
Merged
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
2 changes: 1 addition & 1 deletion charts/base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: base
description: Base Helm chart for Kubernetes - fully values-driven.
type: application
version: 0.6.0
version: 0.6.1
maintainers:
- name: bonddim
sources:
Expand Down
6 changes: 3 additions & 3 deletions charts/base/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# base

![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 0.6.1](https://img.shields.io/badge/Version-0.6.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

Base Helm chart for Kubernetes - fully values-driven.

Expand Down Expand Up @@ -251,7 +251,7 @@ Base Helm chart for Kubernetes - fully values-driven.
| configMap.enabled | bool | `false` | Whether to create a ConfigMap resource. |
| configMap.annotations | object | `{}` | Annotations for the ConfigMap. |
| configMap.labels | object | `{}` | Labels for the ConfigMap. |
| configMap.data | object | `{}` | Key/value data for the ConfigMap. |
| configMap.data | object | `{}` | Key/value data for the ConfigMap (tpl-rendered). A map or list value is rendered as a YAML document, e.g. `{ config.yaml: { log: { level: info } } }`, so it can be deep-merged across values files. |

### Secret parameters

Expand All @@ -268,7 +268,7 @@ Base Helm chart for Kubernetes - fully values-driven.

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| extraObjects | object/list | `[]` | Render additional Kubernetes manifests. Each entry may be a string (with Go template expressions) or a YAML object. |
| extraObjects | object/list | `{}` | Render additional Kubernetes manifests. Each entry may be a string (with Go template expressions) or a YAML object. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
8 changes: 7 additions & 1 deletion charts/base/templates/config/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ metadata:
name: {{ include "base.fullname" . }}
data:
{{- range $key, $value := .Values.configMap.data }}
{{ $key }}: {{ $value | quote }}
{{- $rendered := include "base.render.value" (dict "value" $value "context" $) }}
{{- if or (kindIs "map" $value) (kindIs "slice" $value) (contains "\n" $rendered) }}
{{ $key }}: |
{{- $rendered | nindent 4 }}
{{- else }}
{{ $key }}: {{ $rendered | quote }}
{{- end }}
{{- end }}
{{- end }}
71 changes: 71 additions & 0 deletions charts/base/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
suite: configmap
templates:
- config/configmap.yaml
tests:
- it: renders plain string values as-is
set:
configMap.enabled: true
configMap.data:
LOG_LEVEL: info
asserts:
- equal:
path: data.LOG_LEVEL
value: info

- it: quotes scalar values that are not strings
set:
configMap.enabled: true
configMap.data:
WORKERS: 4
DEBUG: true
asserts:
- equal:
path: data.WORKERS
value: "4"
- equal:
path: data.DEBUG
value: "true"

- it: templates string values
release:
name: myapp
set:
configMap.enabled: true
configMap.data:
SERVICE_HOST: "{{ .Release.Name }}-api"
asserts:
- equal:
path: data.SERVICE_HOST
value: myapp-api

- it: renders map values as a YAML document
set:
configMap.enabled: true
configMap.data:
config.yaml:
Log:
Level: Debug
Database:
Host: db
asserts:
- equal:
path: data["config.yaml"]
value: |
Database:
Host: db
Log:
Level: Debug

- it: templates inside map values
release:
namespace: dev
set:
configMap.enabled: true
configMap.data:
config.yaml:
VaultUrl: "https://kv-{{ .Release.Namespace }}.vault.azure.net"
asserts:
- equal:
path: data["config.yaml"]
value: |
VaultUrl: https://kv-dev.vault.azure.net
5 changes: 3 additions & 2 deletions charts/base/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ configMap:
# -- Labels for the ConfigMap.
# @section -- ConfigMap parameters
labels: {}
# -- Key/value data for the ConfigMap.
# -- Key/value data for the ConfigMap (tpl-rendered). A map or list value is rendered as a YAML document,
# e.g. `{ config.yaml: { log: { level: info } } }`, so it can be deep-merged across values files.
# @section -- ConfigMap parameters
data: {}

Expand Down Expand Up @@ -648,4 +649,4 @@ secret:
########################################################################
# -- (object/list) Render additional Kubernetes manifests. Each entry may be a string (with Go template expressions) or a YAML object.
# @section -- Extras
extraObjects: []
extraObjects: {}
Loading