Code Monkey home page Code Monkey logo

helm-diff's Introduction

Helm Diff Plugin

Go Report Card GoDoc License

This is a Helm plugin giving you 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. This can also be used to compare two revisions/versions of your helm release.

Install

Using Helm plugin manager (> 2.3.x)

helm plugin install https://github.com/databus23/helm-diff

Pre Helm 2.3.0 Installation

Pick a release tarball from the releases page.

Unpack the tarball in your helm plugins directory ($(helm home)/plugins).

E.g.

curl -L $TARBALL_URL | tar -C $(helm home)/plugins -xzv

From Source

Prerequisites

  • GoLang >= 1.21

Make sure you do not have a version of helm-diff installed. You can remove it by running helm plugin uninstall diff

Installation Steps

The first step is to download the repository and enter the directory. You can do this via git clone or downloading and extracting the release. If you clone via git, remember to checkout the latest tag for the latest release.

Next, install the plugin into helm.

make install/helm3

Usage

The Helm Diff Plugin

* Shows a diff explaining 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 to visualize what changes a helm upgrade will perform.

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

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

Usage:
  diff [flags]
  diff [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  release     Shows diff between release's manifests
  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:
      --allow-unreleased                 enables diffing of releases that are not yet deployed via Helm
  -a, --api-versions stringArray         Kubernetes api versions used for Capabilities.APIVersions
      --color                            color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
  -C, --context int                      output NUM lines of context around changes (default -1)
      --detailed-exitcode                return a non-zero exit code when there are changes
      --devel                            use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
      --disable-openapi-validation       disables rendered templates validation against the Kubernetes OpenAPI Schema
      --disable-validation               disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
      --dry-run                          disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
      --enable-dns                       enable DNS lookups when rendering templates 
  -D, --find-renames float32             Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched
  -h, --help                             help for diff
      --include-tests                    enable the diffing of the helm test hooks
      --install                          enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
      --kube-version string              Kubernetes version used for Capabilities.KubeVersion
      --kubeconfig string                This flag is ignored, to allow passing of this top level flag to helm
      --no-color                         remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
      --no-hooks                         disable diffing of hooks
      --normalize-manifests              normalize manifests before running diff to exclude style differences from the output
      --output string                    Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --post-renderer string             the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path
      --post-renderer-args stringArray   an argument to the post-renderer (can specify multiple)
      --repo string                      specify the chart repository url to locate the requested chart
      --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. If '--reset-values' is specified, this is ignored
      --set stringArray                  set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --set-file stringArray             set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
      --set-string stringArray           set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --show-secrets                     do not redact secret values in the output
      --strip-trailing-cr                strip trailing carriage return on input
      --suppress stringArray             allows suppression of the kinds listed in the diff output (can specify multiple, like '--suppress Deployment --suppress Service')
  -q, --suppress-secrets                 suppress secrets in the output
      --three-way-merge                  use three-way-merge to compute patch and generate diff 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.

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 to 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

  # Set HELM_DIFF_IGNORE_UNKNOWN_FLAGS=true to ignore unknown flags
  # It's useful when you're using `helm-diff` in a `helm upgrade` wrapper.
  # See https://github.com/databus23/helm-diff/issues/278 for more information.
  HELM_DIFF_IGNORE_UNKNOWN_FLAGS=true helm diff upgrade my-release stable/postgres --wait

  # helm-diff disallows the use of the `lookup` function by default.
  # To enable it, you must set HELM_DIFF_USE_INSECURE_SERVER_SIDE_DRY_RUN=true to
  # use `helm template --dry-run=server` or
  # `helm upgrade --dry-run=server` (in case you also set `HELM_DIFF_USE_UPGRADE_DRY_RUN`)
  # See https://github.com/databus23/helm-diff/pull/458
  # for more information.
  HELM_DIFF_USE_INSECURE_SERVER_SIDE_DRY_RUN=true helm diff upgrade my-release datadog/datadog

  # Set HELM_DIFF_USE_UPGRADE_DRY_RUN=true to
  # use `helm upgrade --dry-run` instead of `helm template` to render manifests from the chart.
  # See https://github.com/databus23/helm-diff/issues/253 for more information.
  HELM_DIFF_USE_UPGRADE_DRY_RUN=true helm diff upgrade my-release datadog/datadog

  # Set HELM_DIFF_THREE_WAY_MERGE=true to
  # enable the three-way-merge on diff.
  # This is equivalent to specifying the --three-way-merge flag.
  # Read the flag usage below for more information on --three-way-merge.
  HELM_DIFF_THREE_WAY_MERGE=true helm diff upgrade my-release datadog/datadog

  # Set HELM_DIFF_NORMALIZE_MANIFESTS=true to
  # normalize the yaml file content when using helm diff.
  # This is equivalent to specifying the --normalize-manifests flag.
  # Read the flag usage below for more information on --normalize-manifests.
  HELM_DIFF_NORMALIZE_MANIFESTS=true helm diff upgrade my-release datadog/datadog

  # Set HELM_DIFF_OUTPUT_CONTEXT=n to configure the output context to n lines.
  # This is equivalent to specifying the --context flag.
  # Read the flag usage below for more information on --context.
  HELM_DIFF_OUTPUT_CONTEXT=5 helm diff upgrade my-release datadog/datadog

Flags:
      --allow-unreleased                 enables diffing of releases that are not yet deployed via Helm
  -a, --api-versions stringArray         Kubernetes api versions used for Capabilities.APIVersions
  -C, --context int                      output NUM lines of context around changes (default -1)
      --detailed-exitcode                return a non-zero exit code when there are changes
      --devel                            use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
      --disable-openapi-validation       disables rendered templates validation against the Kubernetes OpenAPI Schema
      --disable-validation               disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
      --dry-run                          disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
      --enable-dns                       enable DNS lookups when rendering templates 
  -D, --find-renames float32             Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched
  -h, --help                             help for upgrade
      --include-tests                    enable the diffing of the helm test hooks
      --install                          enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
      --kube-version string              Kubernetes version used for Capabilities.KubeVersion
      --kubeconfig string                This flag is ignored, to allow passing of this top level flag to helm
      --no-hooks                         disable diffing of hooks
      --normalize-manifests              normalize manifests before running diff to exclude style differences from the output
      --output string                    Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --post-renderer string             the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path
      --post-renderer-args stringArray   an argument to the post-renderer (can specify multiple)
      --repo string                      specify the chart repository url to locate the requested chart
      --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. If '--reset-values' is specified, this is ignored
      --set stringArray                  set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --set-file stringArray             set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
      --set-string stringArray           set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --show-secrets                     do not redact secret values in the output
      --strip-trailing-cr                strip trailing carriage return on input
      --suppress stringArray             allows suppression of the values listed in the diff output
  -q, --suppress-secrets                 suppress secrets in the output
      --three-way-merge                  use three-way-merge to compute patch and generate diff 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:
      --color      color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
      --no-color   remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"

release:

$ helm diff release -h

This command compares the manifests details of a different releases created from the same chart

It can be used to compare the manifests of

 - release1 with release2
	$ helm diff release [flags] release1 release2
   Example:
	$ helm diff release my-prod my-stage

Usage:
  diff release [flags] RELEASE release1 [release2]

Flags:
  -C, --context int            output NUM lines of context around changes (default -1)
      --detailed-exitcode      return a non-zero exit code when there are changes
  -D, --find-renames float32   Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched
  -h, --help                   help for release
      --include-tests          enable the diffing of the helm test hooks
      --normalize-manifests    normalize manifests before running diff to exclude style differences from the output
      --output string          Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --show-secrets           do not redact secret values in the output
      --strip-trailing-cr      strip trailing carriage return on input
      --suppress stringArray   allows suppression of the values listed in the diff output
  -q, --suppress-secrets       suppress secrets in the output

Global Flags:
      --color      color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
      --no-color   remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"

revision:

$ helm diff revision -h

This command compares the manifests details of a named release.

It can be used to compare the manifests of

 - latest 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:
  -C, --context int            output NUM lines of context around changes (default -1)
      --detailed-exitcode      return a non-zero exit code when there are changes
  -D, --find-renames float32   Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched
  -h, --help                   help for revision
      --include-tests          enable the diffing of the helm test hooks
      --normalize-manifests    normalize manifests before running diff to exclude style differences from the output
      --output string          Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --show-secrets           do not redact secret values in the output
      --strip-trailing-cr      strip trailing carriage return on input
      --suppress stringArray   allows suppression of the values listed in the diff output
  -q, --suppress-secrets       suppress secrets in the output

Global Flags:
      --color      color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
      --no-color   remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"

rollback:

$ helm diff rollback -h

This command compares the latest manifest 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:
  -C, --context int            output NUM lines of context around changes (default -1)
      --detailed-exitcode      return a non-zero exit code when there are changes
  -D, --find-renames float32   Enable rename detection if set to any value greater than 0. If specified, the value denotes the maximum fraction of changed content as lines added + removed compared to total lines in a diff for considering it a rename. Only objects of the same Kind are attempted to be matched
  -h, --help                   help for rollback
      --include-tests          enable the diffing of the helm test hooks
      --normalize-manifests    normalize manifests before running diff to exclude style differences from the output
      --output string          Possible values: diff, simple, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --show-secrets           do not redact secret values in the output
      --strip-trailing-cr      strip trailing carriage return on input
      --suppress stringArray   allows suppression of the values listed in the diff output
  -q, --suppress-secrets       suppress secrets in the output

Global Flags:
      --color      color output. You can control the value for this flag via HELM_DIFF_COLOR=[true|false]. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"
      --no-color   remove colors from the output. If both --no-color and --color are unspecified, coloring enabled only when the stdout is a term and TERM is not "dumb"

Build

Clone the repository into your $GOPATH and then build it.

$ mkdir -p $GOPATH/src/github.com/databus23/
$ cd $GOPATH/src/github.com/databus23/
$ git clone https://github.com/databus23/helm-diff.git
$ cd helm-diff
$ make install

The above will install this plugin into your $HELM_HOME/plugins directory.

Prerequisites

  • You need to have Go installed. Make sure to set $GOPATH

Running Tests

Automated tests are implemented with testing.

To run all tests:

go test -v ./...

Release

Bump version in plugin.yaml:

$ code plugin.yaml
$ git commit -m 'Bump helm-diff version to 3.x.y'

Set GITHUB_TOKEN and run:

$ make docker-run-release

helm-diff's People

Contributors

cgroschupp avatar codenio avatar cwrau avatar databus23 avatar deiga avatar dependabot[bot] avatar eata219 avatar fwiesel avatar hoesler avatar itscaro avatar jkroepke avatar jonasrutishauser avatar ksa-real avatar kujenga avatar majewsky avatar michaelsauter avatar mjtrangoni avatar mmorel-35 avatar mumoshu avatar njam avatar novas0x2a avatar regner avatar sajfer avatar sarcasticadmin avatar semoac avatar sstarcher avatar tariq1890 avatar tommasopozzetti avatar wi1dcard avatar yxxhero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helm-diff's Issues

Release automation

@databus23 Hi! Would you mind automating the release process of helm-diff, for example with travis or circle ci? Something like the one for helmfile would work.

Please release 2.10.0+2

Hi,

Could someone please make a proper release of 2.10.0+2 so that we can start using the --set-file functionality :)

Cannot build current master branch

../../../k8s.io/helm/pkg/helm/client.go:515:13: resp.GetStatus undefined (type *grpc_health_v1.HealthCheckResponse has no field or method GetStatus)

Identified the first bad commit using git-bisect: e21ba66

--set flag parses numbers as float64

This is effectively the same issue as one filed in Helm upstream, helm/helm#1707, which was resolved in this PR, which adds a --set-string flag to set string values specifically: helm/helm#3599

In order to handle this error case, I believe that helm-diff needs to add support for this flag as well.

Upgrading to newer version does not deploy the binary

Steps

I upgraded from 2.8.0+1 to 2.9.0+2:

$ helm plugin list
NAME   	VERSION	DESCRIPTION
diff   	2.8.0+1	Preview helm upgrade changes as a diff
$ helm plugin update diff
Updated plugin: diff
$ helm plugin list
NAME   	VERSION	DESCRIPTION
diff   	2.9.0+2	Preview helm upgrade changes as a diff

Observation

Now, the binary is not available anymore:

$ helm diff
Error: fork/exec /Users/ced/.helm/plugins/helm-diff/bin/diff: no such file or directory

Remarks

Could an update hook in plugin.yaml help here?

Workaround

Reinstalling resolves the situation:

$ helm plugin remove diff && helm plugin install https://github.com/databus23/helm-diff --version v2.9.0+2

No output (0 exit code)

Hello,
I'm having a bit of a problem running the plugin.
I can see the help with -h, I get a deprecation message when If I try to run help diff without upgrade but when actually running the plugin to see check my diff I get an empty string.
Exit code is 0. Any ideas?
(helm 2.9.1 on osx 10.11.6)

Thanks

helm plugin install does not pin versions

Hey,

I did a rebuild of an image today with pinned helm and helm diff plugin using:

helm plugin install https://github.com/databus23/helm-diff --version v2.8.2+2

and ended up getting a version of helm diff that now required an upgrade subcommand. Is this way of version pinning not meant to work, or is the semver tag actually considered floating?

Allow suppression of actual diff by `kind`

First of all, super helpful tool that we use quite often! Thanks for your time.

We would love to integrate helm-diff a bit tighter in our CI/CD pipeline but have a bit of an issue where we don't want to expose the actual diff of a credential to the output.

It would be extremely handy to be able to blacklist a set of kind resources that would only show a CONTENT CHANGED type message if anything internal had changed instead of actually displaying the contents.

Installation does not work.

Hello,

The installation does not work as described at README

$ helm version                                                                                                                                                         
Client: &version.Version{SemVer:"v2.3.0", GitCommit:"d83c245fc324117885ed83afc90ac74afed271b4", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.3.0", GitCommit:"d83c245fc324117885ed83afc90ac74afed271b4", GitTreeState:"clean"}
 
$ helm plugin install https://github.com/databus23/helm-diff/ ; echo $?                                                                                                
Installed plugin: diff
0
 
$ helm diff                                                                                                                                                            
Error: fork/exec /home/sfrique/.helm/plugins/helm-diff/diff: no such file or directory
FAIL: 1

$ ls -ls /home/sfrique/.helm/plugins/helm-diff/                                                                                                                        
total 48
12 -rw-r--r-- 1 sfrique sfrique 11358 Apr 12 19:23 LICENSE
 4 -rw-r--r-- 1 sfrique sfrique  1201 Apr 12 19:23 Makefile
 4 -rw-r--r-- 1 sfrique sfrique  1511 Apr 12 19:23 README.md
 4 -rw-r--r-- 1 sfrique sfrique  1222 Apr 12 19:23 diff.go
 4 -rw-r--r-- 1 sfrique sfrique  3270 Apr 12 19:23 glide.lock
 4 -rw-r--r-- 1 sfrique sfrique   360 Apr 12 19:23 glide.yaml
 8 -rw-r--r-- 1 sfrique sfrique  4466 Apr 12 19:23 helm.go
 4 -rw-r--r-- 1 sfrique sfrique  2240 Apr 12 19:23 main.go
 0 drwxr-xr-x 1 sfrique sfrique    16 Apr 12 19:23 manifest
 4 -rw-r--r-- 1 sfrique sfrique   269 Apr 12 19:23 plugin.yaml

It seems it is necessary to build, but this is not clear at instructions.

What is the right way of doing it?

installation fails on a fresh Helm installation

$ rm -rf ~/.helm

$ helm init -c
Creating /home/stefan/.helm
Creating /home/stefan/.helm/repository
Creating /home/stefan/.helm/repository/cache
Creating /home/stefan/.helm/repository/local
Creating /home/stefan/.helm/plugins
Creating /home/stefan/.helm/starters
Creating /home/stefan/.helm/cache/archive
Creating /home/stefan/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /home/stefan/.helm.
Not installing Tiller due to 'client-only' flag having been set
Happy Helming!

$ helm version
Client: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.7.0", GitCommit:"08c1144f5eb3e3b636d9775617287cc26e53dba4", GitTreeState:"clean"}

$ helm plugin install https://github.com/databus23/helm-diff
Error: Unable to update checked out version

$ ls -l ~/.helm/plugins
total 0

$ ls -l ~/.helm/cache/plugins/https-github.com-databus23-helm-diff
total 60
-rw-r--r-- 1 stefan users  1702 19. Jan 13:48 diff.go
-rw-r--r-- 1 stefan users  2751 19. Jan 13:48 glide.lock
-rw-r--r-- 1 stefan users   261 19. Jan 13:48 glide.yaml
-rw-r--r-- 1 stefan users  4461 19. Jan 13:48 helm.go
-rwxr-xr-x 1 stefan users  3083 19. Jan 13:48 install-binary.sh
-rw-r--r-- 1 stefan users 11358 19. Jan 13:48 LICENSE
-rw-r--r-- 1 stefan users  2834 19. Jan 13:48 main.go
-rw-r--r-- 1 stefan users  1531 19. Jan 13:48 Makefile
drwxr-xr-x 2 stefan users  4096 19. Jan 13:48 manifest
-rw-r--r-- 1 stefan users   324 19. Jan 13:48 plugin.yaml
-rw-r--r-- 1 stefan users  1510 19. Jan 13:48 README.md
drwxr-xr-x 2 stefan users  4096 19. Jan 13:48 scripts

$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
ID_LIKE=archlinux
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"

Helm-diff plugin can't talk to tiller instances located in other namespaces

using helm diff plugin. I am not able to talk to tiller that are deployed on different namespace.

If i try
helm --tiller-namespace <namespace> [flags] RELEASE CHART

I get Error: unknown flag: --tiller-namespace

The bypass to be able to talk to a tiller instance in another namespace is to set $TILLER_NAMESPACE
environment variable . Or to add the --tiller-namespace flag to helm-diff.

I created a pull request to add the flag for tiller-namespace
#44

version update issue

My CI has suddenly broke when running helm diff

  • helm version
Client: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.7.0", GitCommit:"08c1144f5eb3e3b636d9775617287cc26e53dba4", GitTreeState:"clean"}
  • helm plugin install https://github.com/databus23/helm-diff --version v2.7.0+1
Downloading https://github.com/databus23/helm-diff/releases/download/v2.8.0%2B1/helm-diff-linux.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   609    0   609    0     0    609      0 --:--:-- --:--:-- --:--:--  1208
 32 4419k   32 1443k    0     0   481k      0  0:00:09  0:00:03  0:00:06  714k
 72 4419k   72 3195k    0     0   798k      0  0:00:05  0:00:04  0:00:01 1060k
100 4419k  100 4419k    0     0  1104k      0  0:00:04  0:00:04 --:--:-- 1266k
Preparing to install into /home/jenkins/.helm/plugins/helm-diff
helm-diff installed into /home/jenkins/.helm/plugins/helm-diff/helm-diff
Show a diff explaining 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.

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

Flags:
      --no-color               remove colors from the output
      --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 [])
  -v, --version                show version
Installed plugin: diff
  • helm plugin list
NAME	VERSION	DESCRIPTION                           
diff	2.7.0+1	Preview helm upgrade changes as a diff
  • helm diff -f values.yaml production .
Error: incompatible versions client[v2.8.0] server[v2.7.0]
Usage:
  diff [flags] [RELEASE] [CHART]

Flags:
      --no-color               remove colors from the output
      --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 [])
  -v, --version                show version

Error: plugin "diff" exited with error

support for --reuse-values

First of all, thanks for your good work, we are using this tool quite often. E.g. in our ci pipelines , during the helm deployment step its very helpful to log out what changes happened. In this context we are using the flag --resuse-values which can be applied on the helm upgrade command in order to define only those values which are different to the current deployment. It would be very nice if the diff plugin would support this feature as well.

TLS secured Tiller doesn't work

Hi,

my Helm installation is done with TLS, since the diff sub command doesn't provide any --tls flag I'm not able to use this tool with my setup :(

multiple values files

Hi, thanks for this awesome helm plugin. We would love to use it, but in our setup it does not work.
We specify multiple values files with duplicate keys. helm merges them, but helm diff cannot handle it.
We get errors like that below

2018/04/26 20:41:59 Error: Found duplicate key ", ()" in manifest
2018/04/26 20:41:59 Error: Found duplicate key ", ()" in manifest

Any chance you could look into that?

optional flag to disable color

There's a few use cases for removing the color from the diff, but the one of interest to me, is that the output without color can be added to github, and ```diff will provide the proper syntax highlighting

Support "--reset-values"

I'm using the helm upgrade flag --reset-values:

      --reset-values         when upgrading, reset the values to the ones built into the chart

It works well together with --dry-run --debug.

Would be nice if it was also supported by helm-diff!

Helm plugin install broken

$ helm plugin install https://github.com/databus23/helm-diff
...
Downloading https://github.com/databus23/helm-diff/releases/download/v2.8.2%2B2/helm-diff-linux.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0100   609    0   609    0     0   2845      0 --:--:-- --:--:-- --:--:--  2845
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  6 4749k    6  288k    0     0   216k      0  0:00:21  0:00:01  0:00:20  305k 34 4749k   34 1648k    0     0   697k      0  0:00:06  0:00:02  0:00:04  833k 66 4749k   66 3144k    0     0   948k      0  0:00:05  0:00:03  0:00:02 1073k100 4749k  100 4749k    0     0  1155k      0  0:00:04  0:00:04 --:--:-- 1275k
Preparing to install into /root/.helm/plugins/helm-diff
cp: can't create '/root/.helm/plugins/helm-diff/diff': File exists
Failed to install helm-diff
\tFor support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error

This happens when installing on alpine:3.7 in my Dockerfile with the step:

ENV HELM_VERSION v2.8.2
RUN curl -sfL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz \
  | tar -xz -C /bin/ --strip-components=1 linux-amd64/helm
RUN helm init --client-only \
  && helm plugin install https://github.com/databus23/helm-diff

Incompatible versions

  1. I uninstalled and installed diff using:
helm plugin install https://github.com/databus23/helm-diff --version master
  1. I have helm version 2.9.1 (client & server):
helm version
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
  1. When I try to diff, I'm getting the following error:
Error: incompatible versions client[v2.10.0] server[v2.9.1]
incompatible versions client[v2.10.0] server[v2.9.1]

(I built 2.10 in the past and have it installed somewhere so maybe this has to do with the way you check it.)

specifying a version breaks in certain situations


Downloading https://github.com/databus23/helm-diff/releases/download/v2.9.0%2B2/helm-diff-macos.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   609    0   609    0     0   2953      0 --:--:-- --:--:-- --:--:--  2956
100 4775k  100 4775k    0     0  2630k      0  0:00:01  0:00:01 --:--:-- 3116k
Preparing to install into /Users/sstarcher/.helm/plugins/helm-diff
cp: /tmp/helm-diff/diff/diff: No such file or directory
Failed to install helm-diff
\tFor support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error```

Using helm-diff with a TLS secured tiller

Is it not possible to use helm-diff with a tiller that requires cert authentication?

For normal helm commands I can use the appropriate flags: helm list --tls --tiller-namespace ns, but helm diff revision my-release 2 --tls --tiller-namespace ns throws Error: unknown flag: --tls.

Am I just messing up the syntax or is this not supported?

Install broken on Alpine in Docker

Trying to install this plugin in an Alpine docker container. The container has curl, git and bash installed.

/ # helm plugin install https://github.com/databus23/helm-diff
Downloading https://github.com/databus23/helm-diff/releases/download/v2.4.0%2B1/helm-diff-linux.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   596    0   596    0     0   1379      0 --:--:-- --:--:-- --:--:--  1386
Warning: Failed to create the file /tmp/helm-diff.tgz: No such file or
Warning: directory
  0 13.3M    0 16360    0     0  18195      0  0:12:51 --:--:--  0:12:51 18195
curl: (23) Failed writing body (0 != 16360)
Failed to install helm-diff
\tFor support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error

Looks like something is off with the path that helm-diff.tgz gets downloaded to?

helm s3 integration

Helm diff should play nicely with the helm s3 plugin. - https://github.com/hypnoglow/helm-s3

helm fetch repo/chart --version 0.1.1 works cleanly, but
helm diff release repo/chart --version 0.1.1 fails

Command "helm diff" is deprecated, use "helm diff upgrade" instead
Error: Get s3://syapse-charts/charts/logstash-0.1.1.tgz: unsupported protocol scheme "s3"
Usage:
  diff [flags]
  diff [command]

Available Commands:
  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.

Error: plugin "diff" exited with error

Create a new release with #15

I would love to use the functionality in #15 (new chart diffing), but currently need to maintain my own release to do it. Can you make a new release? Thanks!

[bug] Helm diff shows resources as been removed

Hello

I've been using this plugin for a while and it has worked fine for long!

But for some reason it isn't working when I try to diff after a big (json) change.
the way I am using this is kind o a hack but it's working. This is basically the hack:

$ cat grafana/templates/dashboards-json-configmap.yaml
{{ $root := .}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "grafana.fullname" . }}-dashboards-json
  labels:
    app: {{ template "grafana.name" . }}
    chart: {{ template "grafana.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
{{- if .Values.dashboards }}
  {{- range $key, $value := .Values.dashboards }}
    {{- $path := printf "dashboards/%s.json" $key }}
  {{ $key }}.json: |
{{ $root.Files.Get $path | indent 4 }}
  {{- end }}
{{- end -}}

Any way, changing the files don't have any effect on the diff.
the helm upgrade --dry-run --debug when diffed showed the dasboard change.

After the update even if a do a helm diff revision grafana 4 5
The diff between the manifests seems ok..
helm get manifest grafana --revision 5
helm get manifest grafana --revision 4

It shows as if the charts have been deleted.

I can provide more data if needed, for example maybe the output for each revision.

Just let me know what kind of data you need. The jsons are huge...

$ helm version
Client: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
$ helm plugin list
NAME    VERSION         DESCRIPTION
diff    2.10.0+1        Preview helm upgrade changes as a diff

Install fails because of GitHub api rate limiting

As per doco, I run helm plugin install https://github.com/databus23/helm-diff, and I get:

$ helm plugin install https://github.com/databus23/helm-diff
Downloading
curl: (3) <url> malformed
Failed to install helm-diff
\tFor support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error

My helm:

$ helm version
Client: &version.Version{SemVer:"v2.5.0", GitCommit:"012cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.5.0", GitCommit:"012cb0ac1a1b2f888144ef5a67b8dab6c2d45be6", GitTreeState:"clean"}

Return exit code

I am deploying with Helm from CI and it would be really helpful to have the commands return a different exit code based on whether there is some changes or not. From CI I usually don't care about the actual changes but I want to know if something changed or not.

My suggestion would be to have a --detailed-exit-code flag similar to terraform plan or git diff

The best would probably to do like terraform and return something like this:

  • 0 if no error and no diff
  • 1 if there is an error
  • 2 if no error but a diff

This change would also allow to implement the same flag in helmfile. See roboll/helmfile#133

Any thoughts?

Add support for devel flag

Helm upgrade by default will get released versions. It would be nice to be able to support pre-release versions with the --devel flag.

Oddity with chart searching

  • Running helm search private/elasticsearch returns results
  • Running helm diff upgrade derp private/elasticsearch --allow-unreleased fails with
Error: chart "elasticsearch" matching  not found in private index. (try 'helm repo update'). No chart version found for elasticsearch-
Usage:
  diff upgrade [flags] [RELEASE] [CHART]

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

Flags:
      --allow-unreleased       enables diffing of releases that are not yet deployed via Helm
  -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

Error: plugin "diff" exited with error

Helm-diff for helm 2.10

As we have already helm v2.10-rc.2 could we also have helm-diff plugin for it ?

Using 2.9.0 with helm 2.10 gives error:
Error: incompatible versions client[v2.9.0] server[v2.10.0-rc.2]

context deadline exceeded using latest helm-diff

Hey,

Noticed that after the latest upgrade of helm diff last night, we started seeing consistent errors when issuing helm diff against anything.

07:31:24 Error: context deadline exceeded
07:31:24 Usage:
07:31:24   diff [flags] [RELEASE] [CHART]
07:31:24 
07:31:24 Flags:
07:31:24       --no-color               remove colors from the output
07:31:24       --reset-values           reset the values to the ones built into the chart and merge in any new values
07:31:24       --reuse-values           reuse the last release's values and merge in any new values
07:31:24       --set stringArray        set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
07:31:24       --suppress stringArray   allows suppression of the values listed in the diff output
07:31:24   -q, --suppress-secrets       suppress secrets in the output
07:31:24   -f, --values valueFiles      specify values in a YAML file (can specify multiple) (default [])
07:31:24   -v, --version                show version
07:31:24 
07:31:24 Error: plugin "diff" exited with error
07:31:24 

It's likely related to helm/helm#3715 or helm/helm#2409 because helm get manifest {svc} seems to currently fail on our cluster anyway (hoping helm 2.9 will fix that), but the latest version of helm diff exposes this it seems.

We have confirmed that the latest change is the offending one because:

helm plugin install https://github.com/databus23/helm-diff --version 885e7a720dd31fa24ec50fd1681a86f2a7236c58

fixes our CI image again. We used to just get latest on each image build.

(Thanks a lot for this plugin by the way, has really helped the transparency of our kube CI system.)

Make helm-diff, helmfile diff work better with namespaces for unreleased charts

Currently when you want to diff a chart via helmfile diff under the following conditions:

  • The chart has no previous releases
  • There is a namespace specified in helmfile

The diff is inaccurate because helm upgrade diff --allow-unreleased hard-codes to using the default namespace here. However, helmfile can actually contain the correct namespace and be other than default. This would require for helm-diff to read in the namespace from the cli, if supplied, and require helmfile to send the the namespace as a flag to helm-diff.

helm diff (--)version required tiller

Hi,

both commands

$ helm diff --version
Error: Unauthorized
$ helm diff version
Error: Unauthorized

required an active tiller. some commands like version or help should work without an active tiller.

Windows installation throws error when it tries to run post install hook

On windows, when I try to install the plugin it tries to run .sh file (I presume from hooks.install), which throws an error (since windows doesn't natively run sh files, nor there is an install-binary.sh in the release tgz). When I manually download the release and paste it into .helm/plugins, then it looks for .helm\\plugins\\diff/bin/diff which is incorrect since the tgz file contains exe in the main directory.

It all runs well if I download tgz release, paste it manually, create bin folder for it, and throw .exe file in the bin folder.

Non-portable Tarball

what

  • When installing on alpine:3.8 linux, we see a lot of (harmless) output that doesn't seem really necessary
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.creationtime'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.creationtime'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.creationtime'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'

why

  • Was the package built using "GNU tar"?

Diff between Revisions

Hello,

It would be great if it was possible to diff between already released versions.

Something like this, current release history:

$ helm history winsome-owl                                                                                                                                             [11:04:28]
REVISION        UPDATED                         STATUS          CHART           DESCRIPTION     
1               Wed Apr 12 18:23:28 2017        SUPERSEDED      api-0.1.0    Install complete
2               Wed Apr 12 18:25:55 2017        SUPERSEDED      api-0.1.0    Upgrade complete
3               Wed Apr 12 18:30:48 2017        SUPERSEDED      api-0.1.0    Upgrade complete
4               Wed Apr 12 18:32:39 2017        SUPERSEDED      api-0.1.0    Rollback to 2   
5               Thu Apr 13 00:08:00 2017        DEPLOYED        api-0.1.0    Upgrade complete

So to get a diff between revision 5 (current and 3)

$ helm diff winsome-owl 3

Or explicit get the diff between 4 and 1

$ helm diff winsome-owl 4-1

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.