-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Labels
area/codegenAffects quality or correctness of generated codeAffects quality or correctness of generated codeimpact/usabilitySomething that impacts users' ability to use the product easily and intuitivelySomething that impacts users' ability to use the product easily and intuitivelykind/bugSome behavior is incorrect or out of specSome behavior is incorrect or out of speclanguage/javascriptresolution/fixedThis issue was fixedThis issue was fixed
Description
Expected behavior
Every Kubernetes object has a metadata field. When generating the NodeJS code for a CRD, I expect the type of the metadata field to be similar to the type of the core Kubernetes classes. E.g. I copied this from kubernetes.core.v1.Service:
public readonly metadata!: pulumi.Output<outputs.meta.v1.ObjectMeta>;Current behavior
The metadata field in my generated is this:
public readonly metadata!: pulumi.Output<ObjectMeta | undefined>;Since the metadata field always exists on a Kubernetes object, the | undefined part is not correct.
Steps to reproduce
- Take a GKE cluster.
kubectl get crd backendconfigs.cloud.google.com -o yaml > backendconfigs.yamlcrd2pulumi --nodejsName backendconfig --nodejsPath ./backendconfig backendconfigs.yaml- Create an instance:
const cfg = new backendconfig.cloud.v1.BackendConfig(...) - Try to retrieve the name:
cfg.metadata.name - You get an error:
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:
Affected feature
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/codegenAffects quality or correctness of generated codeAffects quality or correctness of generated codeimpact/usabilitySomething that impacts users' ability to use the product easily and intuitivelySomething that impacts users' ability to use the product easily and intuitivelykind/bugSome behavior is incorrect or out of specSome behavior is incorrect or out of speclanguage/javascriptresolution/fixedThis issue was fixedThis issue was fixed