Skip to content

Commit

Permalink
Better error handling for CRs
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed Apr 17, 2019
1 parent f6083b0 commit 0f66cc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (dcs *DynamicClientSet) NamespacedKind(gvk schema.GroupVersionKind) (bool,

resourceList, err := dcs.DiscoveryClientCached.ServerResourcesForGroupVersion(gv)
if err != nil {
return false, err
return false, &NoNamespaceInfoErr{gvk}
}

for _, resource := range resourceList.APIResources {
Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ func (k *kubeProvider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (
// Validate the object according to the OpenAPI schema.
if err != nil {
resourceNotFound := errors.IsNotFound(err) ||
strings.Contains(err.Error(), "is not supported by the server")
strings.Contains(err.Error(), "is not supported by the server") ||
strings.Contains(err.Error(), "does not support resource type")
k8sAPIUnreachable := strings.Contains(err.Error(), "connection refused")
if resourceNotFound && gvkExists(gvk) {
failures = append(failures, &pulumirpc.CheckFailure{
Expand Down

0 comments on commit 0f66cc2

Please sign in to comment.