pulumi / pulumi-kubernetes

A Pulumi resource provider for Kubernetes to manage API resources and workloads in running clusters
https://www.pulumi.com/docs/reference/clouds/kubernetes/
Apache License 2.0
404 stars 115 forks source link

Allow renderYamlToDirectory to also update the resources on k8s #1620

Open nesl247 opened 3 years ago

nesl247 commented 3 years ago

It would be great if the renderYamlToDirectory feature also updated the kubernetes cluster. The use case is that I want to be able to output files for use with http://skaffold.dev for locally development, but want pulumi to actually update the cluster when running up.

The goal is to not have to duplicate all of the work to build a kubernetes application. While I could write the yaml, and tell pulumi to import it, that removes all of the benefits of having a programming language (templating, etc.).

sheldonhull commented 2 years ago

Exactly what I was trying to find. Pulumi is great. Workflow tools like Skaffold and Devspace.sh don't know about pulumi, they need yaml. Figuring out the blend to leverage the dev workflow of devspace while still using Pulumi seems to be an area not really covered. Not certain it makes sense to start reinventing devspace and such by adding more logic like this to the stack.

prom3theu5 commented 2 years ago

You could probably handle the use case by doing a two pass operation

Have two providers, one loaded from kubeconfig, the other the k8s file provider The file provider outputs the yaml files, then after that has completed, just load them as a ConfigGroup into the actual cluster provider?

shinebayar-g commented 1 year ago

Take a look at this. https://www.pulumi.com/docs/intro/concepts/resources/components/#inheriting-resource-providers Group your resources into pulumi.ComponentResource, then invoke this class with 2 times. 1 with yaml provider, 1 without.