|
| 1 | +# ADR-010: Configuration Update and Merge |
| 2 | + |
| 3 | +Date: 2025-02-27 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Proposed |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +Chart owners may update their configuration schema over time, adding new configuration paths, modifying metadata, or removing obsolete paths. Users who have already configured their deployments need a way to incorporate these updates without losing their existing configurations. |
| 12 | + |
| 13 | +Currently, the Helm Values Manager does not provide a mechanism to update an existing configuration with changes from a new version. This leads to several challenges: |
| 14 | + |
| 15 | +1. Users must manually identify and apply changes between configuration versions |
| 16 | +2. There's a risk of missing new required configuration paths |
| 17 | +3. Users may lose their existing values when updating to a new configuration |
| 18 | +4. Conflicts between user customizations and chart owner updates are difficult to resolve |
| 19 | + |
| 20 | +A structured approach to configuration updates would improve the user experience and reduce the risk of configuration errors. |
| 21 | + |
| 22 | +## Decision |
| 23 | + |
| 24 | +We will implement a configuration update and merge feature that allows users to incorporate changes from a new configuration file while preserving their existing values and deployments. |
| 25 | + |
| 26 | +The feature will: |
| 27 | + |
| 28 | +1. Compare the current configuration with the new one to identify: |
| 29 | + - Added configuration paths |
| 30 | + - Removed configuration paths |
| 31 | + - Modified metadata (description, required, sensitive flags) |
| 32 | + - Potential conflicts |
| 33 | + |
| 34 | +2. Provide multiple merge strategies: |
| 35 | + - "Smart" (default): Preserve user values while adopting new metadata and paths |
| 36 | + - "Theirs": Prefer the new configuration but keep existing values where possible |
| 37 | + - "Ours": Prefer the existing configuration but add new paths |
| 38 | + |
| 39 | +3. Validate the merged configuration to ensure it meets all requirements |
| 40 | + - Identify missing required values |
| 41 | + - Ensure all paths have valid values for their environments |
| 42 | + |
| 43 | +4. Provide clear reporting of changes and required actions |
| 44 | + |
| 45 | +This will be implemented as a new `update-config` command in the CLI. |
| 46 | + |
| 47 | +## Consequences |
| 48 | + |
| 49 | +### Positive |
| 50 | + |
| 51 | +- Users can easily update their configurations when chart owners release updates |
| 52 | +- Existing user values are preserved during updates |
| 53 | +- New required configurations are clearly identified |
| 54 | +- The risk of missing important configuration changes is reduced |
| 55 | +- The update process becomes more transparent and less error-prone |
| 56 | + |
| 57 | +### Negative |
| 58 | + |
| 59 | +- Adds complexity to the codebase |
| 60 | +- May require additional schema versioning to handle major changes |
| 61 | +- Conflict resolution might still require manual intervention in complex cases |
| 62 | + |
| 63 | +### Neutral |
| 64 | + |
| 65 | +- Users will need to learn a new command and its options |
| 66 | +- May need to adjust the configuration schema to better support versioning and updates |
| 67 | + |
| 68 | +## Implementation Notes |
| 69 | + |
| 70 | +The implementation will require: |
| 71 | + |
| 72 | +1. A new `UpdateConfigCommand` class that extends `BaseCommand` |
| 73 | +2. Configuration comparison logic to identify differences |
| 74 | +3. Merge strategies to combine configurations |
| 75 | +4. Validation to ensure the merged configuration is valid |
| 76 | +5. Reporting to communicate changes and required actions |
| 77 | + |
| 78 | +The command will be exposed through the CLI as: |
| 79 | + |
| 80 | +``` |
| 81 | +helm values update-config [source-file] [--strategy=smart|theirs|ours] [--report-only] |
| 82 | +``` |
| 83 | + |
| 84 | +## Related Issues |
| 85 | + |
| 86 | +- GitHub Issue [#19](https://github.com/Zipstack/helm-values-manager/issues/19): Configuration Update and Merge Feature |
0 commit comments