pulumi-kubernetes
pulumi-kubernetes copied to clipboard
[Helm/Release] values are not compatible with helm chart values
Using the dotnet/c# sdk, I tried switching from helm charts to helm releases but the values are not compatible since it doesn't support serializing anonymous types, so although it compiles, it fails at runtime.
Steps to reproduce
- Run gitfool/Pulumi.Dungeon/test using helm charts @ e0354be which succeeds (test-k8s-charts.log)
- Run gitfool/Pulumi.Dungeon/test using helm releases @ a1782b5 which fails (test-k8s-releases.log)
This is just the first failure of many due to the use of anonymous types, for example with cert-manager:
var certManagerValues =
new Dictionary<string, object>
{
["prometheus"] = new
{
enabled = true,
servicemonitor = new { enabled = true }
}
};
This would work for helm releases if I refactored all nested values to use dictionaries:
var certManagerValues =
new Dictionary<string, object>
{
["prometheus"] = new Dictionary<string, object>
{
["enabled"] = true,
["servicemonitor"] = new Dictionary<string, object> { ["enabled"] = true }
}
};
But that is not desirable and I expected helm releases to be a drop in replacement for helm charts, from an api pov, and being able to use anonymous types in c# is essential to reduce the ceremony required to specify helm values. I've included lots of commonly used helm charts for reference; see K8sStack.cs.
Thank you for reporting this @gitfool - that's a legit concern. I suspect this distinction comes from the difference in the implementation where the Chart component is implemented purely in .NET and is able to use Values in-process, while Release is a multi-language resource, so the Values are serialized across the process boundary and that's where anonymous objects fail.
We would need to change our core .NET SDK to support that. @t0yv0 does that makes sense to you? How hard would it be to amend serialization to support anonymous objects?
@t0yv0 does that makes sense to you? How hard would it be to amend serialization to support anonymous objects?
Yeah the problem statement makes sense. I've only glanced at the current serde code in .NET SDK, still need to dive deeper, but it should be quite doable.
Thank you @t0yv0, I opened https://github.com/pulumi/pulumi-dotnet/issues/23 to track