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

🐛 Fix the generation of listType=set #753

Merged
merged 1 commit into from Dec 20, 2022
Merged

Conversation

alvaroaleman
Copy link
Member

It has to have x-kubernetes-map-type: atomic set.

Fixes #752

It has to have x-kubernetes-map-type: atomic set.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 20, 2022
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 20, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [alvaroaleman,vincepri]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@alvaroaleman
Copy link
Member Author

tide?

@apelisse
Copy link

That's bogus to be honest, we're actually not accepting sets of atomic elements (even though that's what the validation says), only scalars can be part of a set.

@JoelSpeed
Copy link
Contributor

I just checked and the following is valid without the atomic flag set, the issue raised in the original issue is because they used an type: object within the set, which must then be atomic according to the current validations.

              set:
                description: Tests the generation of a set list type
                items:
                  type: string
                type: array
                x-kubernetes-list-type: set

@apelisse
Copy link

Yes, a set to "strings" is fine, the validation says that if it's an object, it should be atomic, but that's actually wrong too. So making things atomic will fix the validation error, but will break server-side apply and other merge semantics.

@alvaroaleman
Copy link
Member Author

@apelisse so what is correct? The corev1 api has this on the ResourceRequirements type at the ResourceClaim field. ResourceRequirements is port of corev1.Container, without this patch all crds foir apis that use anything that ends up using a corev1.Container get rejected.

@JoelSpeed
Copy link
Contributor

The upstream API is invalid, we are going to fix the upstream API and get that backported to 1.26, working on that in kubernetes/kubernetes#114585

@liggitt
Copy link

liggitt commented Dec 20, 2022

agreed, please revert this change... overwriting the list type like this will break more things than it fixes in the long term, and produce CRDs that don't behave as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x-kubernetes-map-type=atomic is required if a containing array has x-kubernetes-list-type=set
6 participants