Skip to content

Commit

Permalink
Fix invoke on helm template returning empty response for C# (#2162) (#…
Browse files Browse the repository at this point in the history
…2172)

* Fix invoke on helm template returning empty response (#2162)

* Changelog
  • Loading branch information
viveklak authored Sep 12, 2022
1 parent fa28b86 commit 5429944
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Unreleased
(None)
- Fix Helm Chart preview with unconfigured provider (C#) (https://github.com/pulumi/pulumi-kubernetes/issues/2162)

## 3.21.2 (September 1, 2022)

Expand Down
11 changes: 10 additions & 1 deletion provider/pkg/gen/dotnet-templates/helm/v3/Invokes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ internal static class Invokes
internal static Output<ImmutableArray<ImmutableDictionary<string, object>>> HelmTemplate(HelmTemplateArgs args,
InvokeOptions? options = null)
=> Output.Create(Deployment.Instance.InvokeAsync<HelmTemplateResult>("kubernetes:helm:template", args,
options.WithDefaults())).Apply(r => r.Result.ToImmutableArray());
options.WithDefaults())).Apply(r =>
{
/// Invoke on an unconfigured provider results in an empty response.
/// TODO Change this based on how https://github.com/pulumi/pulumi/issues/10209
/// is addressed.
if (r.Result.IsDefaultOrEmpty) {
return ImmutableArray.Create<ImmutableDictionary<string,object>>();
}
return r.Result;
});
}

internal class HelmTemplateArgs : InvokeArgs
Expand Down
11 changes: 10 additions & 1 deletion sdk/dotnet/Helm/V3/Invokes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ internal static class Invokes
internal static Output<ImmutableArray<ImmutableDictionary<string, object>>> HelmTemplate(HelmTemplateArgs args,
InvokeOptions? options = null)
=> Output.Create(Deployment.Instance.InvokeAsync<HelmTemplateResult>("kubernetes:helm:template", args,
options.WithDefaults())).Apply(r => r.Result.ToImmutableArray());
options.WithDefaults())).Apply(r =>
{
/// Invoke on an unconfigured provider results in an empty response.
/// TODO Change this based on how https://github.com/pulumi/pulumi/issues/10209
/// is addressed.
if (r.Result.IsDefaultOrEmpty) {
return ImmutableArray.Create<ImmutableDictionary<string,object>>();
}
return r.Result;
});
}

internal class HelmTemplateArgs : InvokeArgs
Expand Down

0 comments on commit 5429944

Please sign in to comment.