pulumi-kubernetes
pulumi-kubernetes copied to clipboard
Add "ToYaml" functions
Hello!
- Vote on this issue by adding a 👍 reaction
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
Instead of specifying a directory in the provider to output YAML to, I'd like to be able to get the yaml and/or json directly and do something with it (via ApplyT).
Affected area/feature
SDK
Thanks for the suggestion. I have added this to our backlog to discuss.
As this relates to #2102, I think it would be even better if there was a "dry-run" type of flag on the provider, and combine that with returning the upstream struct types, which contain accurate JSON struct tags. Those 2 features would allow me to serialize the objects any way I want.
Should I maybe change the title of the issue?
@ghostsquad it might be more interesting to understand how you would like some of these features to fit together for your use case. It appears you are trying to leverage the Pulumi kubernetes api in a more general purpose application beyond the core IaC usecase it caters to. Happy to setup some time to chat about this if you are open to sharing your plans.
@viveklak I'm building libraries on top of the Pulumi resources and writing tests. It's currently quite painful to use ApplyT and All in Go, because of the use of interfaces.
Additionally, I've been thinking of wrapping Pulumi using the automation API, and I find that not every field on every k8s resource benefits from being a promise. So the library I'm constructing intends to balance on the line between statically defined types such as in the k8s API and "promise" types in the Pulumi provider. Ultimately, at the end of the program run, compile/runtime primitives (strings, ints, etc) get converted intoinput types that the Pulumi Kubernetes provider requires.
The big part about this is just testing. It's tedious in Go. Do you know if the Pulumi team is working on 1.18 generics support?
Another use case is simply converting to/from JSON/yaml or any other programmatic interface into Pulumi types.
As you may know, most k8s manifests are templates. I personally love Jsonnet for this, but there are limitations with Jsonnet, that a layer of tooling on top, to organize and manage input values can help with. I'm looking to Pulumi to unify how I manage IaC.
Lastly, I've found that it can be very very easy to get cyclical dependencies in kubernetes Pulumi code when strictly using promises.