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

[crd-generator] Map properties lack additionalProperties #3041

Closed
clement-buchart opened this issue Apr 26, 2021 · 0 comments · Fixed by #3074
Closed

[crd-generator] Map properties lack additionalProperties #3041

clement-buchart opened this issue Apr 26, 2021 · 0 comments · Fixed by #3074
Assignees
Labels
component/crd-generator Related to the CRD generator
Milestone

Comments

@clement-buchart
Copy link

Hello,

I've been migrating some internal operator from the go-based CRD generation to the Java based one. Thanks for this lib.

One issue I had during the migration is that when a Spec Pojo has a Map property (in my case Map<String, String>), the generated property in the schema is of type: object but has no additionalProperties field.

Example property

    private Map<String, String> deploymentProperties;

When using using the Go generator, the generated schema is

            deploymentProperties:
              additionalProperties:
                type: string
              type: object

When using using the Java based generator, the schema is

                deploymentProperties:
                  type: object

This make Kubernetes reject my CustomResource when the map is not empty.

My current workaround is

yq e '.spec.versions.[].schema.openAPIV3Schema.properties.spec.properties.deploymentProperties |= ( . * {"additionalProperties" : {"type" : "string"}})' customresource.yaml
@metacosm metacosm self-assigned this Apr 30, 2021
@metacosm metacosm added the component/crd-generator Related to the CRD generator label Apr 30, 2021
@manusa manusa added this to the 5.4.0 milestone May 4, 2021
ddl-audi pushed a commit to ddl-audi/kubernetes-client that referenced this issue May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/crd-generator Related to the CRD generator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants