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
Introduce generated client for core/v1
resources
#11297
Introduce generated client for core/v1
resources
#11297
Conversation
Skipping CI for Draft Pull Request. |
/test all |
a6af07d
to
b52ea38
Compare
/test pull-kubevirt-verify-go-mod |
/test all |
b52ea38
to
e6b727f
Compare
/cc @alaypatel07 |
/cc |
Hello @fossedihelm , I noticed in the commit message that you’ve outlined the task as consisting of three steps. In your commits, you’ve labeled them as “step 1” and “step 2.” However, I’m a bit confused because there seems to be a third step mentioned, but I only see two steps addressed in the commits. Could you please clarify if the second and third steps are included within the same commits, or am i missing something? |
Hey @Barakmor1 sorry about that, as I mentioned in the PR description, this PR only covers the first two steps (Now I have highlighted that part). |
Thanks for clarifying |
func (v *migration) UpdateStatus(vmi *v1.VirtualMachineInstanceMigration) (result *v1.VirtualMachineInstanceMigration, err error) { | ||
func (o *migration) UpdateStatus(vmi *v1.VirtualMachineInstanceMigration) (result *v1.VirtualMachineInstanceMigration, err error) { | ||
result = &v1.VirtualMachineInstanceMigration{} | ||
err = v.restClient.Put(). | ||
err = o.restClient.Put(). | ||
Name(vmi.ObjectMeta.Name). | ||
Namespace(v.namespace). | ||
Resource(v.resource). | ||
Namespace(o.namespace). | ||
Resource(o.resource). | ||
SubResource("status"). |
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.
I think you forgot to use o.VirtualMachineInstanceMigrationInterface.UpdateStatus
here
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.
Nice catch! You're right! Thanks for catching this! Done
I would also remove the 3 step from the commit message or at least mention that it will be handled in the future so it will be clear just from reading the commit messages. |
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 1 of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
e6b727f
to
928e9c4
Compare
Thank you! I dropped the mention of the 3rd step in the commits. |
Thank you ! |
928e9c4
to
64f677c
Compare
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the VMI resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
64f677c
to
d0789bd
Compare
Changes Addressed possible nil pointer reference. |
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the VMIM resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the VMIRS resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the VM resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the KV resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
Convert using the generated client instead of the custom one. This is the path will be followed: 1. Introduction of the generated client. 2. Redirect common api calls to the generated client leaving the custom struct as extended wrapper. This the step 2 for the VMIP resource of the conversion using the generated client. Signed-off-by: fossedihelm <ffossemo@redhat.com>
d0789bd
to
47832f1
Compare
/hold cancel |
@Barakmor1 PTAL 🙂 |
/lgtm |
Required labels detected, running phase 2 presubmits: |
/cherrypick release-1.2 |
@fossedihelm: new pull request created: #11772 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. |
What this PR does
Before this PR:
We are using the generated client for some resources, such as
clone
ormigration
, while we are usingthe custom, manually maintained, for the core resources (VM, VMI...)
After this PR:
Convert using the generated client instead of the custom one.
This is the path will be followed:
leaving the custom struct as extended wrapper.
resources only.
NB: This PR covers just the first two steps, since otherwise the changes will result
too big.*
Fixes #
Why we need it and why it was done in this way
The generated client has the advantage that the various methods will have the same standard signature. Currently, the method's signature between
Get
/Create
/Update
etc.. are different between VM/VMI/etc..:Also, alongside the generated client, the
client-gen
command generates the fakeclient that can be used in unit tests.The fakeclient has the benefit, in unit tests, of simulating the real client and recording the changes, getting rid of mocking API requests (that can create misalignment to the reality) e.g. #10908
Special notes for your reviewer
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.
Release note