Skip to content

Commit 242ab78

Browse files
authored
Merge pull request #49 from aananthraj/feature/revision-diff
Readme and Usage Updation : following #22
2 parents 948639d + f566651 commit 242ab78

File tree

3 files changed

+152
-6
lines changed

3 files changed

+152
-6
lines changed

README.md

Lines changed: 130 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,146 @@
22

33
This is a Helm plugin giving your a preview of what a `helm upgrade` would change.
44
It basically generates a diff between the latest deployed version of a release
5-
and a `helm upgrade --debug --dry-run`
5+
and a `helm upgrade --debug --dry-run`. This can also be used to compare two
6+
revisions/versions of your helm release.
67

78
<a href="https://asciinema.org/a/105326" target="_blank"><img src="https://asciinema.org/a/105326.png" /></a>
89

910
## Usage
1011

1112
```
12-
$ helm diff [flags] RELEASE CHART
13+
The Helm Diff Plugin
14+
15+
* Shows a diff explaing what a helm upgrade would change:
16+
This fetches the currently deployed version of a release
17+
and compares it to a local chart plus values. This can be
18+
used visualize what changes a helm upgrade will perform.
19+
20+
* Shows a diff explaing what had changed between two revisions:
21+
This fetches previously deployed versions of a release
22+
and compares them. This can be used visualize what changes
23+
were made during revision change.
24+
25+
* Shows a diff explaing what a helm rollback would change:
26+
This fetches the currently deployed version of a release
27+
and compares it to adeployed versions of a release, that you
28+
want to rollback. This can be used visualize what changes a
29+
helm rollback will perform.
30+
31+
Usage:
32+
diff [flags]
33+
diff [command]
34+
35+
Available Commands:
36+
revision Shows diff between revision's manifests
37+
rollback Show a diff explaining what a helm rollback could perform
38+
upgrade Show a diff explaining what a helm upgrade would change.
39+
version Show version of the helm diff plugin
40+
41+
Flags:
42+
-h, --help help for diff
43+
--no-color remove colors from the output
44+
--reset-values reset the values to the ones built into the chart and merge in any new values
45+
--reuse-values reuse the last release's values and merge in any new values
46+
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
47+
--suppress stringArray allows suppression of the values listed in the diff output
48+
-q, --suppress-secrets suppress secrets in the output
49+
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
50+
--version string specify the exact chart version to use. If this is not specified, the latest version is used
51+
52+
Additional help topics:
53+
diff
54+
55+
Use "diff [command] --help" for more information about a command.
1356
```
1457

15-
### Flags:
58+
## Commands:
59+
60+
### upgrade:
61+
62+
```
63+
$ helm diff upgrade -h
64+
Show a diff explaining what a helm upgrade would change.
65+
66+
This fetches the currently deployed version of a release
67+
and compares it to a chart plus values.
68+
This can be used visualize what changes a helm upgrade will
69+
perform.
70+
71+
Usage:
72+
diff upgrade [flags] [RELEASE] [CHART]
73+
74+
Examples:
75+
helm diff upgrade my-release stable/postgresql --values values.yaml
76+
77+
Flags:
78+
-h, --help help for upgrade
79+
--reset-values reset the values to the ones built into the chart and merge in any new values
80+
--reuse-values reuse the last release's values and merge in any new values
81+
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
82+
--suppress stringArray allows suppression of the values listed in the diff output
83+
-q, --suppress-secrets suppress secrets in the output
84+
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
85+
--version string specify the exact chart version to use. If this is not specified, the latest version is used
86+
87+
Global Flags:
88+
--no-color remove colors from the output
89+
```
90+
91+
### revision:
1692

1793
```
18-
--set string set values on the command line. See 'helm install -h'
19-
-f, --values valueFiles specify one or more YAML files of values (default [])
94+
$ helm diff revision -h
95+
96+
This command compares the manifests details of a named release.
97+
98+
It can be used to compare the manifests of
99+
100+
- lastest REVISION with specified REVISION
101+
$ helm diff revision [flags] RELEASE REVISION1
102+
Example:
103+
$ helm diff revision my-release 2
104+
105+
- REVISION1 with REVISION2
106+
$ helm diff revision [flags] RELEASE REVISION1 REVISION2
107+
Example:
108+
$ helm diff revision my-release 2 3
109+
110+
Usage:
111+
diff revision [flags] RELEASE REVISION1 [REVISION2]
112+
113+
Flags:
114+
-h, --help help for revision
115+
--suppress stringArray allows suppression of the values listed in the diff output
116+
-q, --suppress-secrets suppress secrets in the output
117+
118+
Global Flags:
119+
--no-color remove colors from the output
120+
```
121+
122+
### rollback:
123+
124+
```
125+
$ helm diff rollback -h
126+
127+
This command compares the laset manifests details of a named release
128+
with specific revision values to rollback.
129+
130+
It forecasts/visualizes changes, that a helm rollback could perform.
131+
132+
Usage:
133+
diff rollback [flags] [RELEASE] [REVISION]
134+
135+
Examples:
136+
helm diff rollback my-release 2
137+
138+
Flags:
139+
-h, --help help for rollback
140+
--suppress stringArray allows suppression of the values listed in the diff output
141+
-q, --suppress-secrets suppress secrets in the output
142+
143+
Global Flags:
144+
--no-color remove colors from the output
20145
```
21146

22147

cmd/root.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,34 @@ import (
55
"github.com/spf13/cobra"
66
)
77

8+
const rootCmdLongUsage = `
9+
The Helm Diff Plugin
10+
11+
* Shows a diff explaing what a helm upgrade would change:
12+
This fetches the currently deployed version of a release
13+
and compares it to a local chart plus values. This can be
14+
used visualize what changes a helm upgrade will perform.
15+
16+
* Shows a diff explaing what had changed between two revisions:
17+
This fetches previously deployed versions of a release
18+
and compares them. This can be used visualize what changes
19+
were made during revision change.
20+
21+
* Shows a diff explaing what a helm rollback would change:
22+
This fetches the currently deployed version of a release
23+
and compares it to adeployed versions of a release, that you
24+
want to rollback. This can be used visualize what changes a
25+
helm rollback will perform.
26+
`
27+
828
func New() *cobra.Command {
929

1030
chartCommand := newChartCommand()
1131

1232
cmd := &cobra.Command{
1333
Use: "diff",
1434
Short: "Show manifest differences",
35+
Long: rootCmdLongUsage,
1536
//Alias root command to chart subcommand
1637
Args: chartCommand.Args,
1738
// parse the flags and check for actions like suppress-secrets, no-colors

cmd/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func newChartCommand() *cobra.Command {
3636
Use: "upgrade [flags] [RELEASE] [CHART]",
3737
Short: "Show a diff explaining what a helm upgrade would change.",
3838
Long: globalUsage,
39-
Example: "helm diff upgrade my-release stable/postgresql --values values.yaml",
39+
Example: " helm diff upgrade my-release stable/postgresql --values values.yaml",
4040
Args: func(cmd *cobra.Command, args []string) error {
4141
return checkArgsLength(len(args), "release name", "chart path")
4242
},

0 commit comments

Comments
 (0)