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
Generated client: embed generated methods into VMIM interface #11639
Conversation
Skipping CI for Draft Pull Request. |
/hold |
cde592b
to
af304c0
Compare
/unhold |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xpivarc 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 |
af304c0
to
fb97532
Compare
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.
Thank you for the PR @fossedihelm.
Please see the inline comments
staging/src/kubevirt.io/client-go/kubecli/generated_mock_kubevirt.go
Outdated
Show resolved
Hide resolved
fb97532
to
0bb19fc
Compare
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.
Thank you for the changes
Required labels detected, running phase 2 presubmits: |
/retest-required |
vmim.Get method does not allow to pass the context and uses the pointer to GetOptions. In order to align the custom method signature with the generated one switch using the GetOptions instead of the pointer one and introduce the context. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
vmim.List method does not allow to pass the context and uses the pointer to ListOptions. In order to align the custom method signature with the generated one switch using the ListOptions instead of the pointer one and introduce the context. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
vmim.Create method does not allow to pass the context and uses the pointer to CreateOptions. In order to align the custom method signature with the generated one switch using the CreateOptions instead of the pointer one and introduce the context. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
0bb19fc
to
1fde966
Compare
@orelmisan Rebased because there were some conflicts in |
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.
Thank you @fossedihelm
Required labels detected, running phase 2 presubmits: |
vmim.Update method does not allow to pass the context and UpdateOptions. In order to align the custom method signature with the generated one introduce the context and the UpdateOptions. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
vmim.Delete method does not allow to pass the context and uses the pointer to DeleteOptions. In order to align the custom method signature with the generated one switch using the DeleteOptions instead of the pointer one and introduce the context. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
vmim.Patch and vmim.PatchStatus methods do not allow to pass the context and PatchOptions. In order to align the custom methods signature with the generated ones introduce the context and the PatchOptions. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Signed-off-by: fossedihelm <ffossemo@redhat.com>
vmim.UpdateStatus method does not allow to pass the context and UpdateOptions. In order to align the custom method signature with the generated one introduce the context and the UpdateOptions. This effort, once all the common methods' signatures are aligned with the generated ones, will converge in the deletion of the custom methods' implementations, embedding the generated interface. Also, removed duplicate metav1 import with different names. Signed-off-by: fossedihelm <ffossemo@redhat.com>
The embed will provide us new methods (`DeleteCollection` and `Watch`). Signed-off-by: fossedihelm <ffossemo@redhat.com>
1fde966
to
108d5de
Compare
Required labels detected, running phase 2 presubmits: |
/retest-required |
/retest-required |
@fossedihelm: The following tests failed, say
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. I understand the commands that are listed here. |
/retest-required |
/retest-required |
What this PR does
Before this PR:
We have our custom
virtualMachineInstanceMigrationInterface
interface with the commonGet
,Delete
, etc...From #11297 the common methods implementation works as a wrapper with different signatures for the generated ones, redirecting the requests to them.
After this PR:
Convert using the generated client signatures instead of the custom one. The generated
virtualMachineInstanceMigrationInterface
is embedded into our custom one, also providing newDeleteCollection
andWatch
methods.The changes inherited are:
Patch
andPatchStatus
now use metav1.PatchOptions{} instead of *metav1.PatchOptions{}.List
now uses metav1.ListOptions{} instead of *metav1.ListOptions{}.Get
now uses metav1.GetOptions{} instead of *metav1.GetOptions{}.Delete
now uses metav1.DeleteOptions{} instead of *metav1.DeleteOptions{}.Create
now receives metav1.CreateOptions{} too.Update
andUpdateStatus
now receive metav1.UpdateOptions{} too.DeleteCollection
,Watch
methods.Context
as first paramether.Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Special notes for your reviewer
For an easier review process the commits was splitted in the following manner:
Create
- introducedCreateOptions
and introduced aContext
Get
- usedGetOptions
instead of the pointer and introduced aContext
List
- usedListOptions
instead of the pointer and introduced aContext
Update
- introducedUpdateOptions
and introduced aContext
Delete
- usedDeleteOptions
instead of the pointer and introduced aContext
Patch
andPatchStatus
- usedPatchOptions
instead of the pointer and introduced aContext
UpdateStatus
- introducedUpdateOptions
and introduced aContext
VirtualMachineInstanceMigrationInterface
into the custom one.Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Design: A design document was considered and is present (link) or not requiredTesting: New code requires new unit tests. New features and bug fixes require at least on e2e testDocumentation: A user-guide update was considered and is present (link) or not required. You want a user-guide update if it's a user facing feature / API change.Community: Announcement to kubevirt-dev was consideredRelease note