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

Crd2pulumi panics on default maps #125

Closed
Alwin-Stockinger opened this issue Jan 11, 2024 · 2 comments · Fixed by #136
Closed

Crd2pulumi panics on default maps #125

Alwin-Stockinger opened this issue Jan 11, 2024 · 2 comments · Fixed by #136
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@Alwin-Stockinger
Copy link

What happened?

Trying to convert karpenter crds the following 2 are failing

Errors:

panic: fatal: error An assertion has failed: could not parse Pulumi package. source error: could not import spec: <nil>: #/types/kubernetes:karpenter.k8s.aws%2Fv1beta1:EC2NodeClassSpec/properties/metadataOptions/default: type kubernetes:karpenter.k8s.aws/v1beta1:EC2NodeClassSpecMetadataOptions cannot have a constant value; only booleans, integers, numbers and strings may have constant values; , and 3 other diagnostic(s)

panic: fatal: error An assertion has failed: could not parse Pulumi package. source error: could not import spec: <nil>: #/types/kubernetes:karpenter.sh%2Fv1beta1:NodePoolSpec/properties/disruption/default: type kubernetes:karpenter.sh/v1beta1:NodePoolSpecDisruption cannot have a constant value; only booleans, integers, numbers and strings may have constant values; , and 1 other diagnostic(s)

Example

This is failing crd2pulumi --nodejs https://raw.githubusercontent.com/aws/karpenter-provider-aws/v0.32.4/pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml

Output of pulumi about

CLI
Version 3.99.0
Go Version go1.21.5
Go Compiler gc

Host
OS fedora
Version 39
Arch x86_64

Additional context

No response

Contributing

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).

@Alwin-Stockinger Alwin-Stockinger added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jan 11, 2024
@mjeffryes
Copy link
Member

Thanks for the bug report @Alwin-Stockinger; it looks like that crd specifies a default for an object (EC2NodeClassSpec/properties/metadataOptions) you should be able to workaround by removing the default lines here:

              metadataOptions:
                default:
                  httpEndpoint: enabled
                  httpProtocolIPv6: disabled
                  httpPutResponseHopLimit: 2
                  httpTokens: required

(The defaults are also present on the individual properties so I don't know why they are specified on the object as well.)

@mjeffryes mjeffryes removed the needs-triage Needs attention from the triage team label Jan 12, 2024
@blampe blampe closed this as completed in 13bd703 May 14, 2024
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 14, 2024
@pulumi-bot
Copy link

This issue has been addressed in PR #136 and shipped in release v1.4.0.

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 resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants