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

Emit useful error when kubernetes:config:kubeconfig fails to parse #636

Merged
merged 2 commits into from
Jul 16, 2019

Conversation

hausdorff
Copy link
Contributor

Fixes #209.

@hausdorff hausdorff force-pushed the hausdorff/kc-parse-error branch 3 times, most recently from 2efc422 to d7832ce Compare July 13, 2019 23:03
@@ -234,7 +234,9 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
if configJSON, ok := vars["kubernetes:config:kubeconfig"]; ok {
config, err := clientcmd.Load([]byte(configJSON))
if err != nil {
return nil, fmt.Errorf("failed to parse kubeconfig: %v", err)
return nil, pkgerrors.Wrap(err, "failed to parse kubeconfig data in "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a YAML literal work here as well as JSON? Also, the wording is a bit informal; I'd kill "and not (say) a filename".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the wording, but I think it's fine to not bother to clarify that JSON is a strict subset of YAML because (1) "YAML" in the k8s ecosystem is used, basically, as shorthand for "JSON or YAML", (20 I've actually never seen someone write kubeconfig in JSON (3) if you do, kubectl auto-converts it to YAML the first time it changes it for any reason, and (4) the ecosystem, IME, largely understands that JSON is a subset of YAML anyway.

@hausdorff hausdorff merged commit 8d019c4 into master Jul 16, 2019
@pulumi-bot pulumi-bot deleted the hausdorff/kc-parse-error branch July 16, 2019 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem parsing kubeconfig when passed via "kubernetes:kubeconfig"
2 participants