Skip to content

support helm v3 #147

Closed
Closed

Description

@nwsparks

With work on Helm 3 progressing at a steady pace, are there any plans to make this plugin work with it? Currently it seems to not be functional and exits with this:

Error: context deadline exceeded
context deadline exceeded
Error: plugin "diff" exited with error
helm.go:76: [debug] plugin "diff" exited with error
main.loadPlugins.func2
        /go/src/helm.sh/helm/cmd/helm/load_plugins.go:95
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).execute
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:762
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).ExecuteC
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:850
helm.sh/helm/vendor/github.com/spf13/cobra.(*Command).Execute
        /go/src/helm.sh/helm/vendor/github.com/spf13/cobra/command.go:800
main.main
        /go/src/helm.sh/helm/cmd/helm/helm.go:75
runtime.main
        /usr/local/go/src/runtime/proc.go:200
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1337

Activity

  1. mumoshu commented on Aug 9, 2019

    @mumoshu
    Collaborator

    I'm willing to support it, but definitely appreciate it if anyone could take it and submit a PR :)

    I'm sharing what I know for anyone interested.

    Helm 3 seems to have a different go module name which allows us to import both helm v2 and v3 as go libraries and make helm-diff works against both versions of helm.

    The part of the problem I thought difficult was how helm-diff should determine which version of helm the plugin was called by.

    Fortunately, Helm v3 seems to pass a different set of envvars to plugins:

    v3: https://github.com/helm/helm/blob/97e7461e41455e58d89b4d7d192fed5352001d44/pkg/plugin/plugin.go#L217
    v2: https://github.com/helm/helm/blob/0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085/pkg/plugin/plugin.go#L172

    So basically helm-diff should be able to determine the version of helm by checking the existence of TILLER_HOST.

    After that, helm-diff should create a v3-flavored Helm storage instance to obtain the Helm release to be processed for diff. Also fortunately we have a great example of code for creating v3 helm storage instance in helm-2to3: https://github.com/hickeyma/helm-2to3/blob/f92469cdd5e2be44153ebbf10c26238e72fdbee8/pkg/v3/connect.go#L62

    Currently, helm-diff does this over API provided by Tiller.

    func createHelmClient() helm.Interface {
    is code we use to create the API client and
    releaseResponse1, err := d.client.ReleaseContent(d.releases[0])
    is an example of how the client is used to get Helm releases. For v3 we should use the store described above.

  2. karuppiah7890 commented on Sep 7, 2019

    @karuppiah7890

    @mumoshu Are you working on this? 😄

  3. mumoshu commented on Sep 7, 2019

    @mumoshu
    Collaborator

    @karuppiah7890 Yep. Please take a look at #149 😃

  4. mumoshu commented on Sep 7, 2019

    @mumoshu
    Collaborator

    FYI helm 3 needs helm/helm#6385 in order for helm upgrade diff --detailed-exitcode to work.

  5. databus23 commented on Oct 25, 2019

    @databus23
    Owner

    I'm closing this now that #151 is merged and released

  6. bakayolo commented on Nov 14, 2019

    @bakayolo

    Hey guys,
    Trying to use diff with helm 3 but does not work.

    $ helm plugin install https://github.com/databus23/helm-diff --version helm3-beta3
    ...
    Use "helm [command] --help" for more information about a command./plugins/helm-diff/bin: File name too long
    Failed to install helm-diff
    \tFor support, go to https://github.com/databus23/helm-diff.
    Error: plugin install hook for "diff" exited with error
    

    or

    $ helm plugin install https://github.com/databus23/helm-diff --version master
    ...
    Installed plugin: diff
    
    $ helm version
    version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
    
    $ helm plugin list
    NAME	VERSION   	DESCRIPTION
    diff	3.0.0-rc.7	Preview helm upgrade changes as a diff
    
    $ helm diff upgrade my-chart . --detailed-exitcode --allow-unreleased --namespace default
    Error: context deadline exceeded
    context deadline exceeded
    Error: plugin "diff" exited with error
    
  7. mumoshu commented on Nov 14, 2019

    @mumoshu
    Collaborator

    @bappr Hey! It doesn't fail with context deadline exceeded for me, at least. I'm wondering if you have connectivity issue with your k8s api? Does helm list work?

  8. bakayolo commented on Nov 14, 2019

    @bakayolo

    @mumoshu yep it works

    NAME                 NAMESPACE	REVISION	UPDATED                             	STATUS  	CHART                      	APP VERSION
    my-chart	default  	5       	2019-11-14 08:30:29.933171 +0800 HKT	deployed	my-chart-0.0.1
    

    And I have upgraded my chart this morning.
    Anyway I can get more logs?

  9. mumoshu commented on Nov 14, 2019

    @mumoshu
    Collaborator

    @bappr Could you run it with --debug like helm --debug dfff ...?

    Also, does it work if you used a non-local chart?

  10. bakayolo commented on Nov 14, 2019

    @bakayolo

    @mumoshu

    With --debug

    Error: context deadline exceeded
    context deadline exceeded
    Error: plugin "diff" exited with error
    helm.go:76: [debug] plugin "diff" exited with error
    

    However with a non-local chart -> it seems that my helm diff still rely on helm 2 (tiller). 🤨

    $ helm diff upgrade my-release stable/postgresql
    Error: Couldn't load repositories file (repository/repositories.yaml).
    You might need to run `helm init` (or `helm init --client-only` if tiller is already installed)
    Couldn't load repositories file (repository/repositories.yaml).
    You might need to run `helm init` (or `helm init --client-only` if tiller is already installed)
    Error: plugin "diff" exited with error
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions