https://pulumi.com logo
#general
Title
# general
w

wooden-queen-36575

06/18/2023, 4:08 PM
Just wanted to share some thoughts on working with Kubernetes CRDs in Pulumi, especially with Typescript. Currently, it's challenging to maintain type-safe coding with CRDs due to certain issues. The crd2pulumi CLI, while initially promising, has been somewhat inconsistent. For instance, I encountered issues when using it with the Pulumi Operator CRD. There's also a complexity around code generation, particularly with a monolithic repo setup. The CLI tends to produce an opinionated project with its own package.json, tsconfig, etc. which aren't aligned with my linting or tsconfig rules. Managing separate repositories for each CRD isn't ideal either. My preference leans toward vendored packages that can be updated easily. An article I found here discusses a potential solution in community-maintained SDKs. But this seems to have its drawbacks too, particularly around longevity and consistency. This is evident from a repository like this which hasn't been updated in a year. Given these concerns, I've been using ConfigFile to apply the raw yaml for CRDs in Pulumi. But this means missing out on some of Pulumi's core benefits - type safety and code completion, especially when dealing with custom resources, which comprise a significant chunk of my work. I'm curious about others' experiences with Kubernetes in Pulumi and Typescript. Also, any insights on how Pulumi plans to address these CRD issues would be appreciated.
a

acceptable-intern-25844

06/18/2023, 5:56 PM
I’ve had the same problems with configuring custom resources. I had some YAMLs to translate into pulumi (with TS), GitHub Copilot helped a bit. There were strange issues with some data types representation in the generated configurations, so I had to double-check everything when something wasn’t working as expected. But in general, it was quite reasonable to translate everything from YAML to pulumi as the configs became DRY.
according to opinionated TSconfig: I’ve found that it’s possible to disable the default TS (it uses too outdated TS version by default) in the root
Pulumi.yaml
:
Copy code
runtime:
  name: nodejs
  options:
    typescript: false
Then compile your TS code as usual, and set the entrypoint for pulumi in
package.json
like this:
Copy code
"main": "dist/index.js",
l

limited-rainbow-51650

06/22/2023, 9:06 AM
@wooden-queen-36575 the mentioned project hasn't been updated in a while because we rely on
crd2pulumi
also. At the moment, there are a number of issues to be fixed first.
10 Views