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

Python CRD's are broken because of hard coded utilities.py #71

Closed
jeid64 opened this issue Jan 31, 2022 · 2 comments · Fixed by #73
Closed

Python CRD's are broken because of hard coded utilities.py #71

jeid64 opened this issue Jan 31, 2022 · 2 comments · Fixed by #73
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec language/python p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@jeid64
Copy link

jeid64 commented Jan 31, 2022

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

Attempting to generate CRD's for use in Python, and when I try to use them I get an AttributeError saying that the _utilities.py class has no lazy_import function.

      File "/home/jeid/work/pulumicrds/./crd/secrets_store/pulumi_crds/__init__.py", line 17, in <module>
        meta = _utilities.lazy_import('pulumi_crds.meta')
    AttributeError: module 'crd.secrets_store.pulumi_crds._utilities' has no attribute 'lazy_import'

https://github.com/pulumi/crd2pulumi/blob/master/gen/python.go#L94 seems to hardcode utilities.py and is missing lazy_import, which is defined in the upstream pulumi codegen code here https://github.com/pulumi/pulumi/blob/b3c56f62c82875d8e907bf4b55f0017b19f2be18/pkg/codegen/python/gen.go#L2602

crd2pulumi is broken on all Python projects as of 671bb76 merging this commit which bumped Pulumi up to v3.21.0, which now requires a bunch of missing utilities.py functions.

Steps to reproduce

  1. wget https://raw.githubusercontent.com/kubernetes-sigs/secrets-store-csi-driver/main/deploy/secrets-store.csi.x-k8s.io_secretproviderclasses.yaml
  2. crd2pulumi --pythonPath ./crd/secrets_store resources/secrets_manager/secrets-store-crd.yaml
  3. import crd.secrets_store.pulumi_crds.secretsstore.v1alpha1 as secrets_store

Downgrading to v1.0.10 of crd2pulumi is broken because of #50 and v1.1.0 is broken because of this issue.

@jeid64 jeid64 added the kind/bug Some behavior is incorrect or out of spec label Jan 31, 2022
@jeid64
Copy link
Author

jeid64 commented Jan 31, 2022

@pgavlin 671bb76 is there any tooling for running tests on the autogenerated Python code?

@jkodroff
Copy link
Member

jkodroff commented Feb 3, 2022

@jeid64 Thank you for this clear, concise, detailed, and actionable issue!

Hey @pgavlin and @viveklak, are either of you available to look at this?

@leezen leezen added the p1 A bug severe enough to be the next item assigned to an engineer label Feb 3, 2022
@leezen leezen added this to the 0.68 milestone Feb 3, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec language/python p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants