Skip to content

Commit b66cfab

Browse files
committed
refactor: rename _getKeyValue.tpl to _getKeyLookup.tpl and add detailed function documentation
On-behalf-of: @SAP angel.kafazov@sap.com Signed-off-by: Angel Kafazov <akafazov@cst-bg.net>
1 parent f024a44 commit b66cfab

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

charts/common/templates/_getKeyValue.tpl charts/common/templates/_getKeyLookup.tpl

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
{{/*
2+
Function: common.getKeyValue
3+
Description:
4+
Retrieves a value from the Helm chart's values.yaml file based on a prioritized key lookup.
5+
The function searches for a value in the following order:
6+
1. An override key (`keyPathOverride`).
7+
2. A global key (`global.keyPath`).
8+
3. A default key (`defaults.keyPath`).
9+
If none of these keys exist, it returns an empty string.
10+
11+
Parameters:
12+
- .key: The path to the key being retrieved.
13+
- .Values: The values object passed to the Helm template.
14+
15+
Dependencies:
16+
- Uses helper functions "common.hasNestedKey" and "common.getNestedValue" to check
17+
the existence of nested keys and retrieve their values.
18+
19+
Usage:
20+
This function is intended to prioritize overrides and global configurations
21+
in a Helm chart's values.yaml file while providing default fallback values.
22+
23+
*/}}
24+
125
{{- define "common.getKeyValue" -}}
226
{{- $keyPath := .key -}}
327
{{- $values := .Values -}}

0 commit comments

Comments
 (0)