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

Do not generate empty required arrays in OneOf definition #10492

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

scholzj
Copy link
Member

@scholzj scholzj commented Aug 26, 2024

Type of change

  • Improvement

Description

Currently, we generate empty required arrays in the OneOf definitions in the CRDs. That seems to cause issues to some tools that do the diffing of the CRDs as Kubernetes seems to remove the empty arrays (see https://cloud-native.slack.com/archives/CMH3Q3SNP/p1724662526753129 as an example).

This PR adds a check and generates the arrays only if they have any values. This is what we already do for the required arrays in other places, so it should hopefully not cause any issues.

Checklist

  • Make sure all tests pass
  • Try your changes from Pod inside your Kubernetes and OpenShift cluster, not just locally

Signed-off-by: Jakub Scholz <www@scholzj.com>
@scholzj scholzj added this to the 0.44.0 milestone Aug 26, 2024
@scholzj scholzj requested a review from a team August 26, 2024 09:56
@scholzj
Copy link
Member Author

scholzj commented Aug 26, 2024

/azp run regression

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@im-konge im-konge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

@scholzj scholzj merged commit 8a48b13 into strimzi:main Aug 27, 2024
21 checks passed
@scholzj scholzj deleted the do-not-generate-empty-required-arrays branch August 27, 2024 08:30
@htolic
Copy link

htolic commented Aug 27, 2024

Until 0.44.0 release, this can be added to ArgoCD Application resource:

  ignoreDifferences:
  - group: 'apiextensions.k8s.io'
    kind: CustomResourceDefinition
    jqPathExpressions:
    - '.spec.versions[]?.schema.openAPIV3Schema.properties.spec.properties[]?.properties[]?.properties[]?.properties.volumes.items.oneOf[]?.required'
    - '.spec.versions[]?.schema.openAPIV3Schema.properties.spec.properties[]?.properties[]?.properties.volumes.items.oneOf[]?.required'

@scholzj
Copy link
Member Author

scholzj commented Aug 27, 2024

@htolic Thanks for sharing this, this might be useful for affected users 🤩

@jetersen
Copy link

jetersen commented Sep 6, 2024

@htolic much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants