Skip to content

Commit 49c1b66

Browse files
committed
docs: Improve ADR-009 lock file handling and add ADR-010 for configuration update and merge feature
1 parent b698ff3 commit 49c1b66

File tree

3 files changed

+104
-2
lines changed

3 files changed

+104
-2
lines changed

docs/ADRs/009-custom-configuration-file-paths.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,17 @@ We will enhance the Helm Values Manager to support custom configuration file pat
5959
Returns:
6060
str: Path to the lock file
6161
"""
62-
config_path = Path(config_file)
63-
lock_file = f".{config_path.name}.lock"
62+
# Expand user home directory if present (e.g., ~/configs)
63+
expanded_path = os.path.expanduser(config_file)
64+
config_path = Path(expanded_path)
65+
66+
# Check if the path is a directory
67+
if config_path.is_dir():
68+
# Use default filename in the specified directory
69+
config_path = config_path / "helm-values.json"
70+
71+
# Create lock file name based on the config file stem (name without extension)
72+
lock_file = f".{config_path.stem}.lock"
6473
return str(config_path.parent / lock_file)
6574
```
6675

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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

docs/ADRs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,10 @@ For new ADRs, use the [ADR template](adr-template.md) as a starting point.
7171
- **Decision**: Add support for custom configuration file paths
7272
- **Impact**: Increases flexibility and improves integration capabilities
7373
- **Dependencies**: ADR-001
74+
75+
### [ADR-010: Configuration Update and Merge](010-configuration-update-and-merge.md)
76+
- **Status**: Proposed
77+
- **Context**: Need to incorporate chart owner configuration updates without losing user customizations
78+
- **Decision**: Implement configuration comparison and smart merging with multiple strategies
79+
- **Impact**: Simplifies configuration updates and reduces risk of missing required changes
80+
- **Dependencies**: ADR-001

0 commit comments

Comments
 (0)