crd2pulumi
crd2pulumi copied to clipboard
Duplicate declarations in generated Golang code
Hello!
- 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)
Issue details
When one attempts to use the crd2pulumi
binary to generate a library from a CRD, the GoLang code errors due to duplicate declarations. Example image attached.

Steps to reproduce
- Grab the ArgoRollout CRD declarations located here
- Initialize your pulumi stack
- Run
crd2pulumi --goPath ./internal/argorollouts install.yaml
Expected: Pulumi will generate a working Golang implementation of the CRD Actual: The GoLang generated by Pulumi is not valid.
Hi, thanks for filing this issue. Do you currently have a workaround?
Do you have any suspicion why it's generating it twice for this CRD - have you seen this issue with other CRDs?
I'm getting this kind of thing with the Python generation. It specifically occurs in outputs.py
and _inputs.py
. Examples:
File "venv/path/lib/python3.8/site-packages/pulumi_crds/networking/v1beta1/outputs.py", line 3680
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'mirror_percent' in function definition
File "venv/path/lib/python3.8/site-packages/pulumi_crds/networking/v1beta1/_inputs.py", line 4536
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'mirror_percent' in function definition
File "venv/path/lib/python3.8/site-packages/pulumi_crds/networking/v1alpha3/outputs.py", line 3870
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'mirror_percent' in function definition
File "venv/path/lib/python3.8/site-packages/pulumi_crds/networking/v1alpha3/_inputs.py", line 4703
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'mirror_percent' in function definition
File "venv/path/lib/python3.8/site-packages/pulumi_crds/security/v1beta1/outputs.py", line 244
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'jwks_uri' in function definition
File "venv/path/lib/python3.8/site-packages/pulumi_crds/security/v1beta1/_inputs.py", line 186
def __init__(__self__, *,
^
SyntaxError: duplicate argument 'jwks_uri' in function definition
My solution is just to manually remove the duplicate parameters from the generated code and it works.
EDIT: I'm using CRDs for Istio and cert-manager, which both have this issue.
@dragos240 I am doing the exact same thing and finding the same problem. @danielrbradley Do you have any plans to fix this? I may be able to take a look at the GoLang code and try to fix it, but I have no experience whatsoever in GoLang, so I'm not 100% sure how easy it would be for me :/ In the meantime, the manual fix is OK
Added to epic https://github.com/pulumi/home/issues/3431
this is the same as https://github.com/pulumi/crd2pulumi/issues/104