Skip to content

Commit b318a5d

Browse files
committed
expand usage guide to readme
1 parent 44be61b commit b318a5d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,49 @@ A plugin to migrate user-specified Helm values between chart versions when the s
1212
$ helm plugin install https://github.com/OctopusDeploy/helm-migrate-values.git
1313
```
1414

15+
## Usage
16+
17+
This Helm plugin enables users to migrate values across chart versions, accounting for changes in the values.yaml schema.
18+
19+
> **_NOTE:_** The intended usage of this plugin is that it does not apply any changes to the release on its own. It simply outputs the values to override, which are meant to be used with `helm upgrade --reset-then-reuse-values`.
20+
>
21+
> See [output values](#optional-output-the-migration-to-a-file) section for an example on how to apply the migration to a release
22+
23+
### Step 1: Define Migration Files
24+
Start by defining migration files within your Helm chart. These files should be placed under the `value-migrations/` directory, relative to your base chart directory. You can customize the migration directory location by using the `--migration-dir` flag.
25+
26+
#### Migration File Naming Convention
27+
Each migration file should follow the naming format:
28+
`to-v{VERSION_TO}.yaml`, where **VERSION_TO** is the target chart version. The plugin will use this file to define the transformation between the previous version and the specified version.
29+
30+
#### Migration File Structure
31+
These migration files are written in YAML, using Go templating for transforming and mapping values from the old schema to the new one. See this [example](pkg/test-charts/v2/value-migrations/to-v2.yaml) from the integration test.
32+
33+
### Step 2: Run the Migration
34+
To migrate your Helm release to a new chart version, use the following command:
35+
```
36+
helm migrate-values [RELEASE] [CHART] [flags]
37+
```
38+
39+
- **RELEASE**: The name of the Helm release you're migrating.
40+
- **CHART**: The chart you're migrating to, which can be a local chart (specified by file path) or a remote chart (using the `oci://` prefix).
41+
42+
## Example
43+
```
44+
helm migrate-values my-kubernetes-agent oci://registry-1.docker.io/octopusdeploy/kubernetes-agent \
45+
--version 2.4.0 \
46+
-n octopus-agent-demo \
47+
--migration-dir kubernetes-agent/value-migrations
48+
```
49+
50+
### Optional: Output the Migration to a File
51+
You can also specify the `--output-file` flag to save the migrated values YAML to a file, allowing you to inspect or use it in subsequent Helm operations:
52+
53+
You can then use this file in a helm upgrade command to complete the migration:
54+
55+
```
56+
helm upgrade [RELEASE] [CHART] -f migrated-values.yaml --reset-then-reuse-values
57+
```
1558

1659
## Contributing
1760
We adhere to [Semantic Versioning](https://semver.org/) and utilize [@changesets/cli](https://github.com/changesets/changesets) to manage release notes and versioning.

0 commit comments

Comments
 (0)