hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.83k stars 449 forks source link

Typed Kubernetes Custom Resource Generator #3701

Open konnta0 opened 1 month ago

konnta0 commented 1 month ago

Description

I think CDKTF is a great and versatile tool! Here are some suggestions to further improve the development experience For k8s Provider, could you consider adding a tool like Pulumi's crd2pulumi to generate structures with types for each programming language from Custom Resource's yaml?

CRD is quite a lot of work to add by hand, so we thought that a tool that can generate boilerplate code might improve the development experience.

If possible, we would be very grateful if you would consider this!

I am new to CDKTF and have no knowledge of it, so if you already have a tool with similar functionality, I would appreciate it if you could point me in the right direction.

References

No response

Help Wanted

Community Note

zmully commented 4 weeks ago

@konnta0 you should take a look at https://cdk8s.io, specifically the cdk8s import which will create a class definition for your CRD, and the Include method, which will create an ApiObject from an existing yaml manifest.

Another option is https://github.com/smallcase/kube2cdk8s which uses Pulumi and cdk8s to template manifests.

konnta0 commented 3 weeks ago

@zmully Thank you for your reply, I will try to get the cdk8s command to work for me. The cdk8s command is indeed a useful tool, but currently it did not seem to support development in .NET (C#). I want to develop in C#, so cdk8s doesn't seem to work for me under the current circumstances... Also, kube2cdk8s only supported TypeScript...

I will consider contributing to https://github.com/cdk8s-team/cdk8s-cli

If you know of any .NET (C#) that could meet our requirements, I would be very happy if you could share it with us!

jsteinich commented 2 weeks ago

I haven't tired it myself, but you could take a look at https://github.com/learnk8s/templating-kubernetes/blob/master/csharp/README.md