pulumi / pulumi

Pulumi - Infrastructure as Code in any programming language 🚀
https://www.pulumi.com
Apache License 2.0
21.89k stars 1.13k forks source link

Standard main wrapper for all gRPC plugins and language hosts. #17242

Open im7mortal opened 2 months ago

im7mortal commented 2 months ago

Hello!

Issue details

Regarding standard cmd framework from #17129. We have many gRPC servers that share the same logic: creating the gRPC server with standard or provided options, setting live checks, setting tracing handlers, starting the server, printing the port, and performing a proper shutdown. pulumi-language-java, pulumi-language-dotnet, pulumi-language-go, pulumi-language-python, pulumi-language-nodejs.

There are likely more instances where this logic is duplicated.

Additionally, this same approach should be applied for Golang policy and any future gRPC plugins.

Wouldn't it be worth implementing a wrapper in the style of the command framework from this pull request? Of course, with more abstraction.

Frassle commented 2 months ago

Wouldn't it be worth implementing a wrapper in the style of the command framework from this pull request? Of course, with more abstraction.

Yes probably, there's probably enough plugins in the pulumi/pulumi sdk to get a good feel for what's needed here. Pretty much just search for all the places we currently use rpcutil.ServeWithOptions.

I've looked into it before and couldn't quickly come up with a good way to express the abstraction given the tools Go gives you, but it might be possible with some more thinking.

im7mortal commented 1 month ago

The CMDs which will have the wrapper.