-
Notifications
You must be signed in to change notification settings - Fork 15
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
[nodejs] Type for generated metadata field incorrect #30
Comments
Update: comparing the type definitions of between my generated code and the k8s
|
I took a look at the schema for the k8s provider, and I think crd2pulumi may not be setting the
Lines 152 to 181 in e646398
|
@lblackstone I don't understand what you are trying to explain here. For the record: I don't have problems with the core Kubernetes |
Sorry, I should have made it clearer that my comment was for whomever works on the fix for this issue. I'm fairly certain this a bug in the schema generated internally by |
Added to epic https://github.com/pulumi/home/issues/3431 |
This issue has been addressed in PR #143 and shipped in release v1.5.0. |
Expected behavior
Every Kubernetes object has a
metadata
field. When generating the NodeJS code for a CRD, I expect the type of themetadata
field to be similar to the type of the core Kubernetes classes. E.g. I copied this fromkubernetes.core.v1.Service
:Current behavior
The
metadata
field in my generated is this:Since the
metadata
field always exists on a Kubernetes object, the| undefined
part is not correct.Steps to reproduce
kubectl get crd backendconfigs.cloud.google.com -o yaml > backendconfigs.yaml
crd2pulumi --nodejsName backendconfig --nodejsPath ./backendconfig backendconfigs.yaml
const cfg = new backendconfig.cloud.v1.BackendConfig(...)
cfg.metadata.name
Property 'name' does not exist on type 'Output<ObjectMeta | undefined>'.
Context (Environment)
I had to remove the
| undefined
part manually from the generated field. A lot more of the generated fields have the same| undefined
section in the type definition, so there might be problems there as well.When following the code path, I ended up here in the core Pulumi
codegen
packages:https://github.com/pulumi/pulumi/blob/1f16423ede4c9b6266f2df5aa4ef2aa8c79ae54f/pkg/codegen/nodejs/gen.go#L263-L265
Affected feature
The text was updated successfully, but these errors were encountered: