Skip to content

Readme and Usage Updation : following #22 #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2018
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
135 changes: 130 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,146 @@

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

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

## Usage

```
$ helm diff [flags] RELEASE CHART
The Helm Diff Plugin

* Shows a diff explaing what a helm upgrade would change:
This fetches the currently deployed version of a release
and compares it to a local chart plus values. This can be
used visualize what changes a helm upgrade will perform.

* Shows a diff explaing what had changed between two revisions:
This fetches previously deployed versions of a release
and compares them. This can be used visualize what changes
were made during revision change.

* Shows a diff explaing what a helm rollback would change:
This fetches the currently deployed version of a release
and compares it to adeployed versions of a release, that you
want to rollback. This can be used visualize what changes a
helm rollback will perform.

Usage:
diff [flags]
diff [command]

Available Commands:
revision Shows diff between revision's manifests
rollback Show a diff explaining what a helm rollback could perform
upgrade Show a diff explaining what a helm upgrade would change.
version Show version of the helm diff plugin

Flags:
-h, --help help for diff
--no-color remove colors from the output
--reset-values reset the values to the ones built into the chart and merge in any new values
--reuse-values reuse the last release's values and merge in any new values
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
--suppress stringArray allows suppression of the values listed in the diff output
-q, --suppress-secrets suppress secrets in the output
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
--version string specify the exact chart version to use. If this is not specified, the latest version is used

Additional help topics:
diff

Use "diff [command] --help" for more information about a command.
```

### Flags:
## Commands:

### upgrade:

```
$ helm diff upgrade -h
Show a diff explaining what a helm upgrade would change.

This fetches the currently deployed version of a release
and compares it to a chart plus values.
This can be used visualize what changes a helm upgrade will
perform.

Usage:
diff upgrade [flags] [RELEASE] [CHART]

Examples:
helm diff upgrade my-release stable/postgresql --values values.yaml

Flags:
-h, --help help for upgrade
--reset-values reset the values to the ones built into the chart and merge in any new values
--reuse-values reuse the last release's values and merge in any new values
--set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
--suppress stringArray allows suppression of the values listed in the diff output
-q, --suppress-secrets suppress secrets in the output
-f, --values valueFiles specify values in a YAML file (can specify multiple) (default [])
--version string specify the exact chart version to use. If this is not specified, the latest version is used

Global Flags:
--no-color remove colors from the output
```

### revision:

```
--set string set values on the command line. See 'helm install -h'
-f, --values valueFiles specify one or more YAML files of values (default [])
$ helm diff revision -h

This command compares the manifests details of a named release.

It can be used to compare the manifests of

- lastest REVISION with specified REVISION
$ helm diff revision [flags] RELEASE REVISION1
Example:
$ helm diff revision my-release 2

- REVISION1 with REVISION2
$ helm diff revision [flags] RELEASE REVISION1 REVISION2
Example:
$ helm diff revision my-release 2 3

Usage:
diff revision [flags] RELEASE REVISION1 [REVISION2]

Flags:
-h, --help help for revision
--suppress stringArray allows suppression of the values listed in the diff output
-q, --suppress-secrets suppress secrets in the output

Global Flags:
--no-color remove colors from the output
```

### rollback:

```
$ helm diff rollback -h

This command compares the laset manifests details of a named release
with specific revision values to rollback.

It forecasts/visualizes changes, that a helm rollback could perform.

Usage:
diff rollback [flags] [RELEASE] [REVISION]

Examples:
helm diff rollback my-release 2

Flags:
-h, --help help for rollback
--suppress stringArray allows suppression of the values listed in the diff output
-q, --suppress-secrets suppress secrets in the output

Global Flags:
--no-color remove colors from the output
```


Expand Down
21 changes: 21 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,34 @@ import (
"github.com/spf13/cobra"
)

const rootCmdLongUsage = `
The Helm Diff Plugin

* Shows a diff explaing what a helm upgrade would change:
This fetches the currently deployed version of a release
and compares it to a local chart plus values. This can be
used visualize what changes a helm upgrade will perform.

* Shows a diff explaing what had changed between two revisions:
This fetches previously deployed versions of a release
and compares them. This can be used visualize what changes
were made during revision change.

* Shows a diff explaing what a helm rollback would change:
This fetches the currently deployed version of a release
and compares it to adeployed versions of a release, that you
want to rollback. This can be used visualize what changes a
helm rollback will perform.
`

func New() *cobra.Command {

chartCommand := newChartCommand()

cmd := &cobra.Command{
Use: "diff",
Short: "Show manifest differences",
Long: rootCmdLongUsage,
//Alias root command to chart subcommand
Args: chartCommand.Args,
// parse the flags and check for actions like suppress-secrets, no-colors
Expand Down
2 changes: 1 addition & 1 deletion cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func newChartCommand() *cobra.Command {
Use: "upgrade [flags] [RELEASE] [CHART]",
Short: "Show a diff explaining what a helm upgrade would change.",
Long: globalUsage,
Example: "helm diff upgrade my-release stable/postgresql --values values.yaml",
Example: " helm diff upgrade my-release stable/postgresql --values values.yaml",
Args: func(cmd *cobra.Command, args []string) error {
return checkArgsLength(len(args), "release name", "chart path")
},
Expand Down