helmfile/docs
yxxhero 472e8c7a2d
fix: error on missing secret key when using vals (#2496)
* fix: error on missing secret key when using vals

Add HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP environment variable
to control whether vals should fail when a referenced key does not
exist in the secret map.

Previously, when a secret reference like ref+vault://path#/nonexistent-key
pointed to a non-existent key, vals would silently return an empty string
without error. This could lead to deployments with missing configuration.

Default behavior remains backward compatible (returns empty string).
Set HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP=true to enable strict mode.

Fixes #1563

Signed-off-by: yxxhero <aiopsclub@163.com>

* refactor: extract buildValsOptions helper and improve tests

- Extract buildValsOptions() to make vals configuration testable
- Use t.Setenv instead of manual env save/restore in tests
- Test actual vals.Options output including FailOnMissingKeyInMap

Addresses PR review comments on #2496

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: use strconv.ParseBool and make tests hermetic

- Use strconv.ParseBool for FailOnMissingKeyInMap parsing to support
  common boolean values like 'TRUE', '1', '0', etc.
- Always set env vars explicitly in tests (even to empty string) to
  prevent flaky tests when env vars are set externally
- Add test cases for various boolean formats

Signed-off-by: yxxhero <aiopsclub@163.com>

* docs: add documentation for vals-related environment variables

Add documentation for:
- HELMFILE_AWS_SDK_LOG_LEVEL: configure AWS SDK logging for vals
- HELMFILE_VALS_FAIL_ON_MISSING_KEY_IN_MAP: enable strict mode for secret refs

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: improve error handling and case-insensitive comparison

- buildValsOptions now returns error for invalid boolean values
  instead of silently defaulting to false
- Use strings.EqualFold for case-insensitive 'off' comparison
  to handle OFF, Off, etc.
- Add test cases for invalid boolean and uppercase OFF
- Update docs to mention case-insensitive and error behavior

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix: normalize log level and improve singleton initialization

- Normalize AWS log level 'off' to lowercase for true case-insensitivity
- Replace sync.Once with mutex to allow recovery from config errors
- Update tests to expect normalized 'off' value
- Update docs to clarify when error is raised

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
2026-03-24 09:42:54 +08:00
..
proposals feat(docs): add proposal to remove charts and delete subcommands (#1936) 2025-02-24 08:11:15 -05:00
advanced-features.md feat: add helm-legacy track mode for Helm v4 compatibility (#2466) 2026-03-08 11:51:14 +08:00
builtin-objects.md Expose release version as .Release.ChartVersion for templating (#2080) 2025-06-17 19:41:42 +08:00
contributing.md Documentation site based on mkdocs and Read the Docs 2022-04-03 05:04:54 +00:00
experimental-features.md v1: Document experimental features (#1512) 2024-05-09 10:18:29 +08:00
hcl_funcs.md feat: Add IP Network to supported HCL Functions (#2426) 2026-02-26 17:20:48 +08:00
index.md fix: error on missing secret key when using vals (#2496) 2026-03-24 09:42:54 +08:00
license.md Documentation site based on mkdocs and Read the Docs 2022-04-03 05:04:54 +00:00
paths.md update examples info (#658) 2023-01-26 07:34:43 +09:00
remote-secrets.md update example chart URL in remote-secrets doc (#1809) 2024-11-28 13:19:08 +08:00
requirements.txt build(deps): bump markdown from 3.6 to 3.8.1 in /docs (#2463) 2026-03-06 11:24:32 +08:00
shared-configuration-across-teams.md chore: documentation updates: grammar & rm whitespace (#1639) 2024-07-21 13:31:41 +08:00
templating_funcs.md feat: add isDir template function (#1657) 2024-08-06 21:39:00 +08:00
users.md Documentation site based on mkdocs and Read the Docs 2022-04-03 05:04:54 +00:00
values-and-merging.md docs: add comprehensive values merging and data flow guide (#2461) 2026-03-09 07:34:05 +08:00
writing-helmfile.md docs: add comprehensive values merging and data flow guide (#2461) 2026-03-09 07:34:05 +08:00