-
Notifications
You must be signed in to change notification settings - Fork 424
Fix APIBinding admission mishandling v1alpha1 API version #3543
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small nit. Can we make name different so language server would not pick it or make it internal?
|
LGTM label has been added. Git tree hash: efc3dde452b166308d184ec650954e824835f024
|
|
/hold |
120b39e to
c8e9127
Compare
|
/cherrypick release-0.28 |
|
@xmudrii: once the present PR merges, I will cherry-pick it on top of release-0.28 in a new PR and assign it to you. In response to this:
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. |
Signed-off-by: Marko Mudrinić <[email protected]>
c8e9127 to
5d32c40
Compare
|
/test pull-kcp-test-integration |
|
/approve |
|
LGTM label has been added. Git tree hash: 24fb2d7a82c68a68d327198ed7b19f146a74d6c7
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xrstf 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:
Approvers can indicate their approval by writing |
|
/hold cancel |
|
@xmudrii: new pull request created: #3544 In response to this:
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. |
Summary
As of v0.28.0, it became impossible to apply v1alpha1 APIBindings. The error would look like this:
We found out that this is happening because the APIBinding admission is mishandling the v1alpha1 API version. The admission plugin would receive the v1alpha1 version of the object, but it would unpack it into the v1alpha2 struct leading to data loss. At the end, the admission plugin would write back the v1alpha2 object, causing further issues in addition to the data loss.
This PR modifies the admission plugin to be able to handle both v1alpha1 and v1alpha2 API versions. The implementation is based on #3539, i.e. I implemented an interface for APIBindings with functions needed by the admission plugin, then there are two implementations of that interface, for v1alpha1 and v1alpha2. I also added some simple unit tests to the APIBindings admission plugin to make sure we test this scenario in the CI.
Alternative considered was that we do conversion inside the APIBindings admission plugin, that would:
This is technically a workaround for not having internal types, which should be our goal for the future. I'll create a ticket to track that.
This will need to be cherry-picked to v0.28.
What Type of PR Is This?
/kind bug
/kind regression
Related Issue(s)
Fixes #3527
Release Notes
/assign @xrstf @embik @mjudeikis