pulumi / crd2pulumi

Generate typed CustomResources from a Kubernetes CustomResourceDefinition
Apache License 2.0
98 stars 16 forks source link

crd2pulumi generator splits types apart into duplicate entires in pulumiTypes.go and pulumiTypes1.go #108

Closed tusharshahrs closed 1 year ago

tusharshahrs commented 1 year ago

What happened?

While running crd2pulumi on CRS for components, we noticed that the generator for Go is splitting the types apart into a pulumiTypes.go and a pulumiTypes1.go. Furthermore, there is some duplication of some type definitions.

Expected Behavior

crd2pulumi install.yaml --go will not duplicate type definition across pulumiTypes.go files (pulumiTypes.go, pulumiTypes1.go, etc

Steps to reproduce

  1. Install crd2pulumi
  2. mkdir myfiles
  3. cd myfiles
  4. Download https://github.com/kyverno/kyverno/blob/v1.8.5/config/install.yaml
  5. Run: crd2pulumi install.yaml --go
  6. cd crds/kubernetes/kyverno/v2beta1/
  7. Notice that there is a pulumiTypes.go and a pulumiTypes1.go file.
  8. Both files contain this exact code:
    type ClusterPolicySpecRulesImageextractorsArrayMap map[string]ClusterPolicySpecRulesImageextractorsArrayInput

Output of pulumi about

pulumi about CLI Version 3.58.0 Go Version go1.20.2 Go Compiler gc

Host OS darwin Version 11.7.4 Arch x86_64

Backend Name pulumi.com URL https://app.pulumi.com/tushar-pulumi-corp User tushar-pulumi-corp Organizations ***

pulumi version v3.58.0

crd2pulumi version v1.2.3

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

justinvp commented 1 year ago

The chunking was originally added to the Go codegen in https://github.com/pulumi/pulumi/pull/10666

AaronFriel commented 1 year ago

Fixed in v1.2.4, released this evening.