Skip to content

🐛 Fix crd flattening for structType marker to not create duplicate entries for XMapType#697

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
chrischdi:pr-fix-XMapTypeFlatten
Jun 29, 2022
Merged

🐛 Fix crd flattening for structType marker to not create duplicate entries for XMapType#697
k8s-ci-robot merged 1 commit into
kubernetes-sigs:masterfrom
chrischdi:pr-fix-XMapTypeFlatten

Conversation

@chrischdi

Copy link
Copy Markdown
Member

Bug was introduced in #693.

As outlined in #693 (comment) , #693 introduced the bug that x-kubernetes-map-type may now get set twice and thus result in two entries in allOf.

This is because before #693 the marker at the type definition was simply ignored but now they got combined.

This PR fixes the flattening to handle this case for the structType marker.

A similar fix for the markers mapType, listType and listMapKey is not necessary because setting them where the type is referenced would result in an error anyway. Before #693 this was also the case, but since #693 it is possible to set them at the type definition.

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 29, 2022
@k8s-ci-robot k8s-ci-robot requested review from droot and mengqiy June 29, 2022 07:17
@chrischdi chrischdi changed the title 🐛 Fix crd flattening for XMapType to not duplicate entries 🐛 Fix crd flattening for structType marker to not create duplicate entries for XMapType Jun 29, 2022
@chrischdi

Copy link
Copy Markdown
Member Author

cc @robbie-demuth : could you give this a try?

@sbueringer

Copy link
Copy Markdown
Member

/cherry-pick release-0.9
/lgtm

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@sbueringer: once the present PR merges, I will cherry-pick it on top of release-0.9 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-0.9
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 29, 2022
@FillZpp

FillZpp commented Jun 29, 2022

Copy link
Copy Markdown
Contributor

/lgtm

@alvaroaleman alvaroaleman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit 1878064 into kubernetes-sigs:master Jun 29, 2022
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@sbueringer: #697 failed to apply on top of branch "release-0.9":

Applying: Fix crd flattening for XMapType to not duplicate entries
Using index info to reconstruct a base tree...
M	pkg/crd/flatten.go
M	pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml
Falling back to patching base and 3-way merge...
Auto-merging pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml
Auto-merging pkg/crd/flatten.go
CONFLICT (content): Merge conflict in pkg/crd/flatten.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix crd flattening for XMapType to not duplicate entries
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Details

In response to this:

/cherry-pick release-0.9
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sbueringer

Copy link
Copy Markdown
Member

@chrischdi Can you please open a manual cherry-pick PR when you have some time? Thank you!

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants