|
| 1 | +--- |
| 2 | +hip: 9999 |
| 3 | +title: "Chart values/v1 Plugin Type" |
| 4 | +authors: ["Scott Rigby <scott@r6by.com>"] |
| 5 | +created: "2026-01-11" |
| 6 | +type: feature |
| 7 | +status: draft |
| 8 | +requires: [chart-defined-plugins] |
| 9 | +helm-version: "4" |
| 10 | +--- |
| 11 | + |
| 12 | +## Abstract |
| 13 | + |
| 14 | +This HIP proposes a new chart-defined plugin type, `values/v1`, that enables plugins to transform chart values before they are coalesced and distributed to subchart dependencies. |
| 15 | + |
| 16 | +## Motivation |
| 17 | + |
| 18 | +### Problem Statement |
| 19 | + |
| 20 | +Umbrella chart authors face a usability challenge when depending on community-maintained subcharts. While leveraging upstream charts reduces operational burden, it forces end users to understand and configure the complex, often inconsistent values structures of each subchart. |
| 21 | + |
| 22 | +**Example:** An umbrella chart might depend on 5+ subcharts, each with different conventions for: |
| 23 | + |
| 24 | +- Domain configuration (`.host`, `.domain`, `.ingress.hosts[0].host`) |
| 25 | +- Replica counts (`.replicaCount`, `.replicas`, `.primary.replicas`) |
| 26 | +- TLS settings (nested under various paths) |
| 27 | + |
| 28 | +Currently, umbrella chart `values.yaml` files must expose these implementation details to users. |
| 29 | + |
| 30 | +### User Stories |
| 31 | + |
| 32 | +**As an umbrella chart author**, I want to define a simple `values.yaml` for end users (e.g., `domain: myapp.example.com`) and have those values automatically mapped to the complex structures each subchart expects. |
| 33 | + |
| 34 | +**As an end user**, I want to configure a single `domain` value and have it apply consistently across all components. |
| 35 | + |
| 36 | +### Community Interest |
| 37 | + |
| 38 | +This problem has been raised repeatedly: |
| 39 | + |
| 40 | +- [#8576](https://github.com/helm/helm/issues/8576) / [#8580](https://github.com/helm/helm/pull/8580) - map.yaml proposal (2020) |
| 41 | +- [#6699](https://github.com/helm/helm/issues/6699) - Passing parent values to subcharts (2020) |
| 42 | +- [#12323](https://github.com/helm/helm/issues/12323) - Templated values for subchart dependencies (2023) |
| 43 | +- [#12668](https://github.com/helm/helm/issues/12668) - Shared values between subcharts (2023) |
| 44 | +- [#13493](https://github.com/helm/helm/issues/13493) - Value CEL mapping (2024) |
| 45 | + |
| 46 | +### Why a Plugin? |
| 47 | + |
| 48 | +Implementing this as a plugin type rather than a core feature: |
| 49 | + |
| 50 | +1. **Extensibility**: Different strategies (declarative mappings, CEL expressions) can compete |
| 51 | +2. **Independent Evolution**: Plugins iterate faster than Helm's release cycle |
| 52 | +3. **Reduced Core Complexity**: Keeps Helm core focused on its primary responsibilities |
| 53 | + |
| 54 | +## Specification |
| 55 | + |
| 56 | +### Plugin Type Definition |
| 57 | + |
| 58 | +```yaml |
| 59 | +type: values/v1 |
| 60 | +``` |
| 61 | +
|
| 62 | +### Execution Point |
| 63 | +
|
| 64 | +The `values/v1` plugin is invoked in the values processing pipeline: |
| 65 | + |
| 66 | +``` |
| 67 | +1. Load chart values.yaml |
| 68 | +2. Merge with -f files (in order) |
| 69 | +3. Apply --set and --set-string flags |
| 70 | +4. ──► INVOKE values/v1 PLUGINS ◄── |
| 71 | +5. CoalesceValues() distributes values to subcharts |
| 72 | +6. ValidateAgainstSchema() validates coalesced values |
| 73 | +7. Template rendering |
| 74 | +``` |
| 75 | +
|
| 76 | +The plugin receives the fully merged user values and returns transformed values. These transformed values are then coalesced (distributed to subcharts) and schema-validated. |
| 77 | +
|
| 78 | +### Plugin Interface |
| 79 | +
|
| 80 | +**Input (JSON provided to the plugin):** |
| 81 | +
|
| 82 | +```json |
| 83 | +{ |
| 84 | + "chartMetadata": { |
| 85 | + "name": "my-umbrella-chart", |
| 86 | + "version": "1.0.0", |
| 87 | + "apiVersion": "v3" |
| 88 | + }, |
| 89 | + "chartFiles": { |
| 90 | + "<filename>": "<contents>", |
| 91 | + ... |
| 92 | + }, |
| 93 | + "inputValues": { |
| 94 | + "domain": "myapp.example.com", |
| 95 | + "highAvailability": true |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +The plugin receives: |
| 101 | + |
| 102 | +- Chart metadata for context |
| 103 | +- Chart files (plugin may use configuration files) |
| 104 | +- The merged input values |
| 105 | + |
| 106 | +**Output (JSON returned by the plugin):** |
| 107 | + |
| 108 | +```json |
| 109 | +{ |
| 110 | + "transformedValues": { |
| 111 | + "domain": "myapp.example.com", |
| 112 | + "highAvailability": true, |
| 113 | + "ingress-nginx": { ... }, |
| 114 | + "postgresql": { ... } |
| 115 | + }, |
| 116 | + "errors": [], |
| 117 | + "log": ["..."] |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +The plugin returns: |
| 122 | + |
| 123 | +- **transformedValues**: The full values object after transformation, including subchart-namespaced keys |
| 124 | +- **errors**: If non-empty, Helm aborts with these error messages |
| 125 | +- **log**: Debug messages shown when `--debug` is used |
| 126 | + |
| 127 | +### Values Merging |
| 128 | + |
| 129 | +Transformed values follow standard Helm coalescing after plugin execution: |
| 130 | + |
| 131 | +1. Plugin returns transformed values |
| 132 | +2. `CoalesceValues()` merges with subchart defaults |
| 133 | +3. User `--set` values targeting subchart paths take precedence |
| 134 | + |
| 135 | +### Chart.yaml Declaration |
| 136 | + |
| 137 | +Charts declare `values/v1` plugins per [Chart-defined plugins HIP](https://github.com/helm/community/pull/433): |
| 138 | + |
| 139 | +```yaml |
| 140 | +apiVersion: v3 |
| 141 | +name: my-umbrella-chart |
| 142 | +version: 1.0.0 |
| 143 | + |
| 144 | +plugins: |
| 145 | + - name: my-values-plugin |
| 146 | + type: values/v1 |
| 147 | + repository: oci://ghcr.io/example/my-values-plugin |
| 148 | + version: "1.0.0" |
| 149 | + |
| 150 | +subcharts: |
| 151 | + - name: postgresql |
| 152 | + version: 13.0.0 |
| 153 | + repository: https://charts.bitnami.com/bitnami |
| 154 | +``` |
| 155 | +
|
| 156 | +### Multiple Plugins |
| 157 | +
|
| 158 | +Charts may declare multiple `values/v1` plugins. They execute sequentially in list order, each receiving the output of the previous plugin. |
| 159 | + |
| 160 | +### Debug Output |
| 161 | + |
| 162 | +When `--debug` is used, the plugin's log output is displayed, allowing users to see what transformations were applied. |
| 163 | + |
| 164 | +## Relationship to Schema Validation |
| 165 | + |
| 166 | +**Current behavior:** |
| 167 | + |
| 168 | +- JSON Schema validation (`values.schema.json`) runs on **coalesced** values |
| 169 | +- The `--skip-schema-validation` flag skips this validation |
| 170 | + |
| 171 | +**With values/v1:** |
| 172 | + |
| 173 | +- Plugin transforms values BEFORE coalescing |
| 174 | +- Coalescing distributes transformed values to subcharts |
| 175 | +- JSON Schema validation runs on coalesced (transformed) values |
| 176 | +- Plugin errors abort independently of schema validation |
| 177 | + |
| 178 | +**Plugin errors:** |
| 179 | + |
| 180 | +- A values/v1 plugin can return errors for any condition |
| 181 | +- Plugin receives ONLY the values at its invocation point: |
| 182 | + - Initial user-supplied values merged with chart defaults |
| 183 | + - After any preceding values/v1 plugins in the Chart.yaml list |
| 184 | +- Not a replacement for schema validation—complementary |
| 185 | + |
| 186 | +## Use Cases |
| 187 | + |
| 188 | +The `values/v1` plugin type enables various transformation strategies: |
| 189 | + |
| 190 | +1. **Value mapping**: Simple values → complex subchart structures |
| 191 | +2. **Conditional logic**: Switch/case based on input values |
| 192 | +3. **Custom error logic**: Return errors if business rules are violated |
| 193 | +4. **Value computation**: Derive values from inputs |
| 194 | + |
| 195 | +How a plugin implements these is up to the plugin author. |
| 196 | + |
| 197 | +## Backwards Compatibility |
| 198 | + |
| 199 | +- Charts without plugins continue to work unchanged |
| 200 | +- Charts with `values/v1` plugins fail gracefully with installation instructions |
| 201 | +- No changes to existing chart APIs |
| 202 | + |
| 203 | +## Security Implications |
| 204 | + |
| 205 | +### Sandboxing |
| 206 | + |
| 207 | +The plugin requires minimal capabilities: |
| 208 | + |
| 209 | +- Read: Access to chart files (already loaded in memory) |
| 210 | +- Compute: Transform values |
| 211 | +- No I/O: No filesystem, network, or exec access |
| 212 | + |
| 213 | +Wasm runtime provides sandboxing guarantees. |
| 214 | + |
| 215 | +### Transformation Visibility |
| 216 | + |
| 217 | +All transformations are logged via `--debug`, ensuring: |
| 218 | + |
| 219 | +- Users can audit changes |
| 220 | +- No hidden modifications |
| 221 | + |
| 222 | +## How to Teach This |
| 223 | + |
| 224 | +1. Update "Subcharts and Global Values" guide to mention values plugins |
| 225 | +2. Create "Values Plugins" documentation |
| 226 | + |
| 227 | +## Reference Implementation |
| 228 | + |
| 229 | +A reference implementation demonstrating rule-based transformations is planned: |
| 230 | + |
| 231 | +- **Runtime**: Wasm via Extism |
| 232 | +- **Configuration**: Rule-based YAML format supporting mappings, conditionals, and assertions |
| 233 | +- **Distribution**: OCI registry |
| 234 | + |
| 235 | +Implementation status: **Not started** (pending HIP acceptance) |
| 236 | + |
| 237 | +## Rejected Ideas |
| 238 | + |
| 239 | +### Recommend Forking Subcharts |
| 240 | + |
| 241 | +Recommending that users fork upstream charts to simplify values creates maintenance burden and security risks. |
| 242 | + |
| 243 | +### Library Chart Helpers |
| 244 | + |
| 245 | +Library chart templates execute AFTER values coalescing, so cannot transform what subcharts receive. |
| 246 | + |
| 247 | +### Include Schema Validation in values/v1 |
| 248 | + |
| 249 | +Including schema validation in values/v1 rather than keeping it separate: |
| 250 | + |
| 251 | +- JSON Schema validation operates at a different stage (after coalescing) |
| 252 | +- values/v1 operates before coalescing |
| 253 | +- JSON Schema validation remains as the standard mechanism |
| 254 | + |
| 255 | +## References |
| 256 | + |
| 257 | +- [HIP-0016: Export-Values Directive](https://github.com/helm/community/blob/main/hips/hip-0016.md) |
| 258 | +- [HIP-0026: Wasm Plugin System](https://github.com/helm/community/blob/main/hips/hip-0026.md) |
| 259 | +- [Chart-defined plugins HIP (PR #433)](https://github.com/helm/community/pull/433) |
| 260 | +- [GitHub Issue #13493: Value CEL Mapping](https://github.com/helm/helm/issues/13493) - Most recent proposal |
0 commit comments