Skip to content

Commit

Permalink
Emit useful error when kubernetes:config:kubeconfig fails to parse
Browse files Browse the repository at this point in the history
Fixes #209.
  • Loading branch information
hausdorff committed Jul 15, 2019
1 parent a8047e5 commit 4854c49
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## 0.25.3 (Unreleased)

### Supported Kubernetes versions

- v1.15.x
- v1.14.x
- v1.13.x

### Bug fixes

- Emit a useful error message (rather than a useless one) if we fail to parse the YAML data in
`kubernetes:config:kubeconfig` (https://github.com/pulumi/pulumi-kubernetes/pull/636).


## 0.25.2 (July 11, 2019)

### Supported Kubernetes versions
Expand All @@ -10,7 +22,7 @@

### Improvements

- The Kubernetes provider can now communicate detailed information about the difference between a resource's
- The Kubernetes provider can now communicate detailed information about the difference between a resource's
desired and actual state during a Pulumi update. (https://github.com/pulumi/pulumi-kubernetes/pull/618).
- Refactor Pod await logic for easier testing and maintenance (https://github.com/pulumi/pulumi-kubernetes/pull/590).
- Update to client-go v12.0.0 (https://github.com/pulumi/pulumi-kubernetes/pull/621).
Expand Down Expand Up @@ -72,7 +84,7 @@ desired and actual state during a Pulumi update. (https://github.com/pulumi/pulu

BREAKING: This release changes the behavior of the provider `namespace` flag introduced
in `0.23.0`. Previously, this flag was treated as an override, which ignored namespace
values set directly on resources. Now, the flag is a default, and will only set the
values set directly on resources. Now, the flag is a default, and will only set the
namespace if one is not already set. If you have created resources using a provider
with the `namespace` flag set, this change may cause these resources to be recreated
on the next update.
Expand Down
5 changes: 4 additions & 1 deletion pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/golang/glog"
pbempty "github.com/golang/protobuf/ptypes/empty"
structpb "github.com/golang/protobuf/ptypes/struct"
"github.com/pkg/errors"
pkgerrors "github.com/pkg/errors"
"github.com/pulumi/pulumi-kubernetes/pkg/await"
"github.com/pulumi/pulumi-kubernetes/pkg/clients"
Expand Down Expand Up @@ -234,7 +235,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 "+
"`kubernetes:config:kubeconfig`; this must be a YAML literal string and not "+
"a filename or path")
}
kubeconfig = clientcmd.NewDefaultClientConfig(*config, overrides)
} else {
Expand Down

0 comments on commit 4854c49

Please sign in to comment.