Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 49 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,53 @@ We use GitHub to host code, to track issues and feature requests, as well as acc
5. Make sure your code passes all code quality checks.
6. Issue that pull request!

## Version Control Guidelines

### Branch Naming
- Feature branches: `feature/short-description`
- Bug fixes: `fix/issue-description`
- Documentation: `docs/what-changed`
- Release branches: `release/version-number`

### Commit Messages
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

Types:
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation only changes
- `style`: Changes that do not affect the meaning of the code
- `refactor`: Code change that neither fixes a bug nor adds a feature
- `test`: Adding missing tests or correcting existing tests
- `chore`: Changes to the build process or auxiliary tools

Example:
```
feat(value): add support for remote storage backends

- Implement ValueBackend interface
- Add AWS Secrets Manager backend
- Add Azure Key Vault backend

Closes #123
```

## Important Documentation

Before contributing, please review these important documents:

1. [Code Structure](docs/Development/code-structure.md) - Understanding the codebase organization
2. [Testing Guide](docs/Development/testing.md) - Testing standards and practices
3. [Architecture Overview](docs/Design/low-level-design.md) - System architecture and design decisions
4. [ADRs](docs/ADRs/) - Architecture Decision Records

## Development Setup

1. Clone your fork:
Expand Down Expand Up @@ -86,12 +133,6 @@ tox -e py39 # For Python 3.9
- Follow Google style for docstrings
- Keep the README.md and other documentation up to date

### Documentation Requirements

- Use docstrings for all public modules, functions, classes, and methods
- Follow Google style for docstrings
- Keep the README.md and other documentation up to date

#### Required Extensions

When contributing to documentation, please note that we use the following extensions:
Expand All @@ -115,7 +156,7 @@ To preview Mermaid diagrams locally, you can:

## Any contributions you make will be under the MIT Software License

In short, when you submit code changes, your submissions are understood to be under the same [MIT License](LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern.
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](./LICENSE) that covers the project. Feel free to contact the maintainers if that's a concern.

## Report bugs using GitHub's [issue tracker](https://github.com/zipstack/helm-values-manager/issues)

Expand All @@ -135,4 +176,4 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]

## License

By contributing, you agree that your contributions will be licensed under its MIT License.
By contributing, you agree that your contributions will be licensed under its [MIT License](./LICENSE).
4 changes: 2 additions & 2 deletions docs/ADRs/001-helm-values-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Managing configurations and secrets across multiple Kubernetes deployments is a
Key challenges include:
- Ensuring configurations remain consistent across different environments (e.g., dev, staging, production).
- Managing sensitive values securely using external secret management systems.
- Automating the generation of `values.json` while integrating with GitOps tools like ArgoCD.
- Automating the generation of `values.yaml` while integrating with GitOps tools like ArgoCD.
- Providing a user-friendly CLI that integrates well with Helm workflows.

## Decision
Expand All @@ -22,7 +22,7 @@ We have decided to implement the **Helm Values Manager** as a **Helm plugin writ
4. **Secret Storage Abstraction:** Securely manages sensitive values by integrating with AWS Secrets Manager, Azure Key Vault, and HashiCorp Vault.
5. **CLI-Based Approach:** Interactive commands for managing configurations and secrets.
6. **Autocomplete Support:** Smooth CLI experience.
7. **ArgoCD Compatibility:** Generates `values.json` dynamically for GitOps workflows.
7. **ArgoCD Compatibility:** Generates `values.yaml` dynamically for GitOps workflows.
8. **JSON for Configuration:** Using JSON for configuration files provides better schema validation and consistent parsing across different platforms.

### Value Storage Model
Expand Down
137 changes: 137 additions & 0 deletions docs/ADRs/005-unified-backend-approach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# ADR-005: Unified Backend Approach for Value Storage

## Status
Proposed

## Context
Currently, the Value class handles two distinct storage types: local and remote. This creates a split in logic within the Value class, requiring different code paths and validation rules based on the storage type. This complexity makes the code harder to maintain and test.

## Decision
We will remove the storage_type distinction from the Value class and implement a SimpleValueBackend for non-sensitive data (previously handled as "local" storage). This means:

1. Value class will:
- Only interact with backends through a unified interface
- Not need to know about storage types
- Have simpler logic and better separation of concerns

2. Storage backends will:
- Include a new SimpleValueBackend for non-sensitive data
- All implement the same ValueBackend interface
- Be responsible for their specific storage mechanisms

3. Configuration will:
- Use SimpleValueBackend internally for non-sensitive values
- Use secure backends (AWS/Azure) for sensitive values
- Backend selection handled by the system based on value sensitivity

## Consequences

### Positive
1. **Cleaner Value Class**
- Removes storage type logic
- Single consistent interface for all operations
- Better separation of concerns

2. **Unified Testing**
- All storage types tested through the same interface
- No need for separate local/remote test cases
- Easier to mock and verify behavior

3. **More Flexible**
- Easy to add new backend types
- Consistent interface for all storage types
- Clear extension points

4. **Better Security Model**
- Storage backend choice driven by data sensitivity
- Clear separation between sensitive and non-sensitive data
- Explicit in configuration

### Negative
1. **Slight Performance Impact**
- Additional method calls for simple value operations
- Extra object creation for SimpleValueBackend

### Neutral
1. **Configuration Changes**
- Backend selection based on value sensitivity
- Transparent to end users

## Implementation Plan

1. **Backend Development**
```python
class SimpleValueBackend(ValueBackend):
def __init__(self):
self._values = {}

def get_value(self, path: str, environment: str) -> str:
key = self._make_key(path, environment)
return self._values[key]

def set_value(self, path: str, environment: str, value: str) -> None:
key = self._make_key(path, environment)
self._values[key] = value
```

2. **Value Class Simplification**
```python
@dataclass
class Value:
path: str
environment: str
_backend: ValueBackend

def get(self) -> str:
return self._backend.get_value(self.path, self.environment)

def set(self, value: str) -> None:
if not isinstance(value, str):
raise ValueError("Value must be a string")
self._backend.set_value(self.path, self.environment, value)
```

3. **Configuration Example**
```json
{
"version": "1.0",
"release": "my-app",
"deployments": {
"prod": {
"backend": "aws",
"auth": {
"type": "managed_identity"
},
"backend_config": {
"region": "us-west-2"
}
}
},
"config": [
{
"path": "app.replicas",
"description": "Number of application replicas",
"required": true,
"sensitive": false,
"values": {
"dev": "3",
"prod": "5"
}
},
{
"path": "app.secretKey",
"description": "Application secret key",
"required": true,
"sensitive": true,
"values": {
"dev": "dev-key-123",
"prod": "prod-key-456"
}
}
]
}
```

The system will automatically:
- Use SimpleValueBackend for non-sensitive values (app.replicas)
- Use configured secure backend for sensitive values (app.secretKey)
Loading