Hello, I’ve used crd2pulumi to generate Go code fo...
# golang
b
Hello, I’ve used crd2pulumi to generate Go code for cert-manager CRDs and I get the following file structure:
Copy code
crds
└── go
    ├── acme
    │   ├── v1
    │   │   ├── challenge.go
    │   │   ├── init.go
    │   │   ├── order.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha2
    │   │   ├── challenge.go
    │   │   ├── init.go
    │   │   ├── order.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha3
    │   │   ├── challenge.go
    │   │   ├── init.go
    │   │   ├── order.go
    │   │   └── pulumiTypes.go
    │   └── v1beta1
    │       ├── challenge.go
    │       ├── init.go
    │       ├── order.go
    │       └── pulumiTypes.go
    ├── certmanager
    │   ├── v1
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha2
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha3
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   └── v1beta1
    │       ├── certificate.go
    │       ├── certificateRequest.go
    │       ├── clusterIssuer.go
    │       ├── init.go
    │       ├── issuer.go
    │       └── pulumiTypes.go
    └── pulumiUtilities.go
I expected that the acme folder be under the certmanager folder, since the API group of these CRDs is
<http://acme.cert-manager.io|acme.cert-manager.io>
. I see from the code (https://github.com/pulumi/crd2pulumi/blob/765df3fae9a0b07043229c4d540c8808a5c25d65/gen/generate.go#L335) that only the first word of the API group is kept. Couldn’t we take as crd2pulumi argument a suffix to remove from the API group and a prefix to add so that for example
crd2pulumi -g --prefix-to-add certmanager --suffix-to-remove <http://cert-manager.io|cert-manager.io> cert-manager.crds.yaml
would give a structure like that?
Copy code
crds
└── go
    ├── certmanager
    │   ├── acme
    │   │   ├── v1
    │   │   │   ├── challenge.go
    │   │   │   ├── init.go
    │   │   │   ├── order.go
    │   │   │   └── pulumiTypes.go
    │   │   ├── v1alpha2
    │   │   │   ├── challenge.go
    │   │   │   ├── init.go
    │   │   │   ├── order.go
    │   │   │   └── pulumiTypes.go
    │   │   ├── v1alpha3
    │   │   │   ├── challenge.go
    │   │   │   ├── init.go
    │   │   │   ├── order.go
    │   │   │   └── pulumiTypes.go
    │   │   └── v1beta1
    │   │       ├── challenge.go
    │   │       ├── init.go
    │   │       ├── order.go
    │   │       └── pulumiTypes.go
    │   ├── v1
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha2
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   ├── v1alpha3
    │   │   ├── certificate.go
    │   │   ├── certificateRequest.go
    │   │   ├── clusterIssuer.go
    │   │   ├── init.go
    │   │   ├── issuer.go
    │   │   └── pulumiTypes.go
    │   └── v1beta1
    │       ├── certificate.go
    │       ├── certificateRequest.go
    │       ├── clusterIssuer.go
    │       ├── init.go
    │       ├── issuer.go
    │       └── pulumiTypes.go
    └── pulumiUtilities.go