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

Issue with x_kubernetes_preserve_unknown_fields in java com.pulumi.kubernetes.apiextensions.v1.CustomResourceDefinition #3325

Open
elonazoulay opened this issue Nov 22, 2024 · 0 comments
Labels
kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team

Comments

@elonazoulay
Copy link

elonazoulay commented Nov 22, 2024

What happened?

I am attempting to create a CustomResourceDefinition that has a field with x-kubernetes-preserve-unknown-fields set to true via the x_kubernetes_preserve_unknown_fields method and expected the resource to be created but instead get the following error:

Caused by: java.lang.IllegalArgumentException: Expected type 'com.pulumi.kubernetes.apiextensions.v1.outputs.JSONSchemaProps' (annotated with 'com.pulumi.core.annotations.CustomType') to have a setter annotated with @com.pulumi.core.annotations.CustomType$Setter("x-kubernetes-preserve-unknown-fields"), got: $schema,nullable,x_kubernetes_int_or_string,minLength,pattern,description,type,title,required,example,exclusiveMaximum,patternProperties,allOf,not,default,oneOf,additionalItems,x_kubernetes_embedded_resource,id,maxProperties,exclusiveMinimum,x_kubernetes_validations,definitions,multipleOf,maxItems,x_kubernetes_list_type,format,anyOf,enum,minProperties,dependencies,minItems,x_kubernetes_preserve_unknown_fields,x_kubernetes_list_map_keys,uniqueItems,maximum,additionalProperties,x_kubernetes_map_type,externalDocs,minimum,$ref,items,maxLength,properties
    	at com.pulumi.serialization.internal.Converter.lambda$tryConvertObjectInner$7(Converter.java:401)
    	at java.base/java.util.HashMap.forEach(HashMap.java:1429)
    	at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:399)
    	at com.pulumi.serialization.internal.Converter.tryConvertMap(Converter.java:665)
    	at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:281)
    	at com.pulumi.serialization.internal.Converter.lambda$tryConvertObjectInner$7(Converter.java:426)
    	... 34 more

If I remove the fields in the example below that contain x_kubernetes_preserve_unknown_fields it works.

Example

This is the removed portion of the spec:

.put("coordinator", JSONSchemaPropsArgs.builder()
                                                                                        .type("object")
                                                                                        .properties(ImmutableMap.<String, JSONSchemaPropsArgs>builder()
                                                                                                .put("etcConfigFiles", JSONSchemaPropsArgs.builder()
                                                                                                        .x_kubernetes_preserve_unknown_fields(true)
                                                                                                        .build())
                                                                                                .buildOrThrow())
                                                                                        .build())

Which is the equivalent of the following yaml (which does work with kubectl apply -f):

                    etcConfigFiles:
                      x-kubernetes-preserve-unknown-fields: true
                      type: object                   

Output of pulumi about

CLI
Version 3.137.0
Go Version go1.23.2
Go Compiler gc

Plugins
KIND NAME VERSION
language java unknown

Host
OS darwin
Version 14.6.1
Arch arm64

This project is written in java: executable='/Users/elon.azoulay/.jenv/shims/java' version='openjdk 22.0.2 2024-07-16
OpenJDK Runtime Environment Temurin-22.0.2+9 (build 22.0.2+9)
OpenJDK 64-Bit Server VM Temurin-22.0.2+9 (build 22.0.2+9, mixed mode)' maven='Apache Maven 3.9.9 ()' gradle='8.11' java='/Users/elon.azoulay/.jenv/shims/java' javac='22.0.2'

Backend
Name pulumi.com
URL https://app.pulumi.com/elonazoulay
User elonazoulay
Organizations elonazoulay, starburstdata
Token type personal

No dependencies found

Pulumi locates its logs in /var/folders/5q/524n82557j5_bh2vy4pwr0d00000gq/T/ by default

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

@elonazoulay elonazoulay added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Nov 22, 2024
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 needs-triage Needs attention from the triage team
Projects
None yet
Development

No branches or pull requests

1 participant