Skip to content

provider seems to fall back to, rather than ignore, kubeconfig_path when kubeconfig_raw is set #90

Closed
@pmahoney

Description

@pmahoney

I'm using version 0.3.1.

I haven't investigated this completely, but I was setting kubeconfig_raw in the provider, which was invalid in some way (I believe), and it seemed like the plugin fell back to the default context in my local ~/.kube/config.

This seems contrary to the docs, which state

If kubeconfig_raw is set, kubeconfig_path is ignored.

And it's also potentially highly dangerous to use an unexpected kubeconfig.

// try to get a config from kubeconfig_raw
config, err = getClientConfig(data, context)
if err != nil {
// if kubeconfig_raw did not work, try kubeconfig_path
path := d.Get("kubeconfig_path").(string)
data, _ = readKubeconfigFile(path)
config, err = getClientConfig(data, context)
if err != nil {
// if neither worked we fall back to an empty default config
config = &rest.Config{}
}
}

I fixed my config, but would like:

  • any error using kubeconfig_raw should be logged
  • if kubeconfig_raw was set but failed, it should not fallback to kubeconfig_path
  • any error using kubeconfig_path should be logged
  • perhaps the docs should suggest specifying a non-default context to prevent accidentally using the wrong kubeconfig

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