Skip to content

v3: --kube-context, --kubeconfig and --namespace values are not passed to plugins #6631

Closed

Description

@mumoshu

Problem

While upgrading helm-diff to work with helm v3, we noticed that a few settings that formerly passed via the local proxy to Tiller now need to be passed explicitly to plugins:

  • --kubeconfig
  • --kube-context
  • --namespace

// Additional discussion in helm/helm: #6508 (comment)

This is due to that some plugin like helm-diff does need to access release objects normally managed by helm.

More concretely, as of today when a plugin like helm-diff is invoked via helmv3 --kubeconfig mykubeconfig --kube-context mycontext --namespace myns diff upgrade myrelease mychart, the plugin needs all the three settings in order to read the release object for myrelease, but there's no way to access those from within the plugin.

Proposed solution

I believe these 3 settings should somehow be propagated to plugins. I'd suggest using envvars as it seems like the primary way to pass contextual settings to plugins today:

helm/pkg/plugin/plugin.go

Lines 218 to 225 in 9bc7934

func SetupPluginEnv(settings *cli.EnvSettings, name, base string) {
env := settings.EnvVars()
env["HELM_PLUGIN_NAME"] = name
env["HELM_PLUGIN_DIR"] = base
for key, val := range env {
os.Setenv(key, val)
}
}


Output of helm version: helm 3.0.0-beta.1~4
Cloud Provider/Platform (AKS, GKE, Minikube etc.): Any

Activity

  1. added a commit that references this issue on Oct 10, 2019
    da351de
  2. added
    v3.x
    on Oct 10, 2019
  3. mumoshu commented on Oct 11, 2019

    @mumoshu
    ContributorAuthor

    @bacongobbler Hey! Thanks for confirming this.

    Can we consider this as a fix and link the PR for this(#6632) to any of the prereleases of v3.0.0, hopefully, 3.0.0-beta.5?

    From a plugin maintainer's perspective, I'm considering this a kind of regression due to the removal of Tiller.

  4. bacongobbler commented on Oct 11, 2019

    @bacongobbler
    Member

    Agreed. Now with tiller removed this is the core piece that plugins need to connect to the Kubernetes API. In a way, it's a usability regression. I'll add this into the beta.5 for review.

  5. added this to the 3.0.0-beta.5 milestone on Oct 11, 2019
  6. added a commit that references this issue on Oct 11, 2019
    69adc5a
  7. bacongobbler commented on Oct 11, 2019

    @bacongobbler
    Member

    closed via #6632

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

    v3.x

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions