|
1 | 1 | # AGENTS.md |
2 | 2 |
|
3 | 3 | ## Overview |
4 | | -Helm is a package manager for Kubernetes written in Go, supporting v3 (stable) and v4 (unstable) APIs. |
5 | 4 |
|
6 | | -## Build & Test |
| 5 | +Helm is a package manager for Kubernetes written in Go. It enables users to define, install, and upgrade complex Kubernetes applications using charts. |
| 6 | +This document provides an overview of the codebase structure, development guidelines, and key patterns for contributors. |
| 7 | + |
| 8 | +The codebase supports both an SDK for advanced users, and a CLI for direct end user usage. |
| 9 | + |
| 10 | +The project currently supports Helm v3 and Helm v4 versions, based on the `dev-v3` and `main` branches respectively. |
| 11 | + |
| 12 | +## Build and test |
| 13 | + |
7 | 14 | ```bash |
8 | 15 | make build # Build binary |
9 | 16 | make test # Run all tests (style + unit) |
10 | 17 | make test-unit # Unit tests only |
11 | 18 | make test-coverage # With coverage |
12 | | -make test-style # Linting |
13 | | -golangci-lint run # Direct linting |
| 19 | +make test-style # Linting (wraps golangci-lint) |
14 | 20 | go test -run TestName # Specific test |
15 | 21 | ``` |
16 | 22 |
|
17 | | -## Code Structure |
18 | | -- `/cmd/helm/` - CLI entry point (Cobra-based) |
19 | | -- `/pkg/` - Public API |
| 23 | +## Code structure |
| 24 | + |
| 25 | +Major packages: |
| 26 | + |
| 27 | +- `cmd/helm/` - CLI entry point, wires CLI flags to `pkg/cmd/` commands |
| 28 | +- `pkg/` - Public API |
20 | 29 | - `action/` - Core operations (install, upgrade, rollback) |
| 30 | + - `cmd/` - Cobra command implementations bridging CLI flags to `pkg/action/` |
21 | 31 | - `chart/v2/` - Stable chart format |
22 | 32 | - `engine/` - Template rendering (Go templates + Sprig) |
| 33 | + - `kube/` - Kubernetes client abstraction layer |
23 | 34 | - `registry/` - OCI support |
| 35 | + - `release/` - Release types and interfaces (`v1/`, `common/`) |
| 36 | + - `repo/` - Chart repository indexing and interaction |
24 | 37 | - `storage/` - Release backends (Secrets/ConfigMaps/SQL) |
25 | | -- `/internal/` - Private implementation |
| 38 | +- `internal/` - Private implementations |
26 | 39 | - `chart/v3/` - Next-gen chart format |
| 40 | + - `release/v2/` - Release package for chart v3 support |
| 41 | + |
| 42 | +## Development |
| 43 | + |
| 44 | +### Compatibility |
| 45 | + |
| 46 | +Changes are required to maintain backward compatibility as described in [HIP-0004: Document backwards-compatibility rules](https://github.com/helm/community/blob/main/hips/hip-0004.md). |
| 47 | + |
| 48 | +Typically this means that: |
27 | 49 |
|
28 | | -## Development Guidelines |
| 50 | +- the signatures of public APIs, i.e., those in the `pkg/` directory should not change |
| 51 | +- CLI commands and parameters should not be removed or changed in a way that would break existing scripts or workflows |
| 52 | +- functional behaviour (as implied or documented) must not be modified in a way that would break existing users' expectations |
| 53 | + |
| 54 | +An exception to the above is where incompatible changes are needed to fix a security vulnerability, where minimal breaking changes may be made to address the issue. |
| 55 | + |
| 56 | +### Code standards |
29 | 57 |
|
30 | | -### Code Standards |
31 | 58 | - Use table-driven tests with testify |
32 | 59 | - Golden files in `testdata/` for complex output |
33 | 60 | - Mock Kubernetes clients for action tests |
34 | 61 | - All commits must include DCO sign-off: `git commit -s` |
35 | 62 |
|
36 | 63 | ### Branching |
37 | | -- `main` - Helm v4 development |
38 | | -- `dev-v3` - Helm v3 stable (backport from main) |
39 | 64 |
|
40 | | -### Dependencies |
| 65 | +Standard workflow is for PR development changes to the `main` branch. Minor release branches are cut from `main`, then maintained for critical fixes via patch releases. |
| 66 | +Bug and security fixes are also backported to `dev-v3` where applicable. |
| 67 | + |
| 68 | +Development branches: |
| 69 | + |
| 70 | +- `main` - Helm v4 |
| 71 | +- `dev-v3` - Helm v3 (backport security and bugfixes from main) |
| 72 | + |
| 73 | +Release branches: |
| 74 | + |
| 75 | +- `release-v3.X` - Release branches for v3.X versions |
| 76 | +- `release-v4.X` - Release branches for v4.X versions |
| 77 | + |
| 78 | +### Major dependencies |
| 79 | + |
41 | 80 | - `k8s.io/client-go` - Kubernetes interaction |
42 | 81 | - `github.com/spf13/cobra` - CLI framework |
43 | 82 | - `github.com/Masterminds/sprig` - Template functions |
44 | 83 |
|
45 | | -### Key Patterns |
46 | | -- **Actions**: Operations in `/pkg/action/` use shared Configuration |
47 | | -- **Dual Chart Support**: v2 (stable) in `/pkg/`, v3 (dev) in `/internal/` |
48 | | -- **Storage Abstraction**: Pluggable release storage backends |
| 84 | +### Key patterns |
| 85 | + |
| 86 | +- **Actions**: High-level operations live in `pkg/action/`, typically using a shared Configuration |
| 87 | +- **Chart versions**: Charts v2 (stable) in `pkg/chart/v2`, v3 (under development) in `internal/chart/v3` |
| 88 | +- **Plugins and extensibility**: Enabling additional functionality via plugins and extension points, such as custom template functions or storage backends is preferred over incorporating into Helm's codebase |
0 commit comments