Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tusharshahrs opened this issue Mar 23, 2023 · 2 comments · Fixed by pulumi/pulumi#12484 or #109
Assignees
Labels
customer/feedback Feedback from customers kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@tusharshahrs
Copy link

tusharshahrs commented Mar 23, 2023

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).

@tusharshahrs tusharshahrs added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 23, 2023
@tusharshahrs tusharshahrs changed the title crd2pulumi generator splits types apart into multiple files such as pulumiTypes.go and pulumiTypes1.go crd2pulumi generator splits types apart into duplicate entires in pulumiTypes.go and pulumiTypes1.go Mar 23, 2023
@tusharshahrs tusharshahrs added the p1 A bug severe enough to be the next item assigned to an engineer label Mar 23, 2023
@t0yv0 t0yv0 self-assigned this Mar 23, 2023
@t0yv0 t0yv0 removed the needs-triage Needs attention from the triage team label Mar 23, 2023
@t0yv0 t0yv0 added this to the 0.86 milestone Mar 23, 2023
@justinvp
Copy link
Member

The chunking was originally added to the Go codegen in pulumi/pulumi#10666

bors bot added a commit to pulumi/pulumi that referenced this issue Mar 23, 2023
12484: Fix emission of dup types breaking Go compilation when chunking >500 … r=t0yv0 a=t0yv0

…helper types

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description


Fixes pulumi/crd2pulumi#108


Fix emission of dup types breaking Go compilation when chunking >500 helper types.

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

Fixes # (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Mar 24, 2023
@AaronFriel
Copy link

Fixed in v1.2.4, released this evening.

@justinvp justinvp added the customer/feedback Feedback from customers label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer/feedback Feedback from customers kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
5 participants