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

Generated client: embed generated methods into VMIM interface #11639

Merged
merged 8 commits into from Apr 11, 2024

Conversation

fossedihelm
Copy link
Contributor

@fossedihelm fossedihelm commented Apr 3, 2024

What this PR does

Before this PR:
We have our custom virtualMachineInstanceMigrationInterface interface with the common Get, 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 new DeleteCollection and Watch methods.
The changes inherited are:

  • Patch and PatchStatus 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 and UpdateStatus now receive metav1.UpdateOptions{} too.
  • Added DeleteCollection, Watch methods.
  • All the methods above take a 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:

  1. Align our custom common methods' signature to the generated one in the following order:
    • Create - introduced CreateOptions and introduced a Context
    • Get - used GetOptions instead of the pointer and introduced a Context
    • List - used ListOptions instead of the pointer and introduced a Context
    • Update - introduced UpdateOptions and introduced a Context
    • Delete - used DeleteOptions instead of the pointer and introduced a Context
    • Patch and PatchStatus - used PatchOptions instead of the pointer and introduced a Context
    • UpdateStatus - introduced UpdateOptions and introduced a Context
  2. Embed the generated 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.

Release note

NONE

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Apr 3, 2024
@fossedihelm
Copy link
Contributor Author

/hold
let's wait for #11523 to reduce conflicts.
/test all

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2024
@fossedihelm fossedihelm force-pushed the embed-generated-vmim branch 4 times, most recently from cde592b to af304c0 Compare April 9, 2024 09:09
@fossedihelm
Copy link
Contributor Author

/unhold
#11523 was merged

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 9, 2024
@fossedihelm fossedihelm marked this pull request as ready for review April 9, 2024 09:10
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 9, 2024
@fossedihelm
Copy link
Contributor Author

/cc @xpivarc @orelmisan @Barakmor1

Copy link
Member

@xpivarc xpivarc left a comment

Choose a reason for hiding this comment

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

/approve

pkg/util/status/status_test.go Outdated Show resolved Hide resolved
@kubevirt-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 9, 2024
Copy link
Member

@orelmisan orelmisan left a 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

Copy link
Member

@orelmisan orelmisan left a 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

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 9, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-1.27-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.29-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-storage
/test pull-kubevirt-e2e-k8s-1.27-sig-compute
/test pull-kubevirt-e2e-k8s-1.27-sig-operator
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

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>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
@fossedihelm
Copy link
Contributor Author

@orelmisan Rebased because there were some conflicts in pkg/virt-controller/watch/drain/evacuation/evacuation_test.go PTAL

Copy link
Member

@orelmisan orelmisan left a comment

Choose a reason for hiding this comment

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

Thank you @fossedihelm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-1.27-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.29-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-storage
/test pull-kubevirt-e2e-k8s-1.27-sig-compute
/test pull-kubevirt-e2e-k8s-1.27-sig-operator
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator

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>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 10, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-1.27-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.29-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-network
/test pull-kubevirt-e2e-k8s-1.27-sig-storage
/test pull-kubevirt-e2e-k8s-1.27-sig-compute
/test pull-kubevirt-e2e-k8s-1.27-sig-operator
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator

@fossedihelm
Copy link
Contributor Author

/retest-required

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot
Copy link
Contributor

kubevirt-bot commented Apr 11, 2024

@fossedihelm: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-check-tests-for-flakes 108d5de link false /test pull-kubevirt-check-tests-for-flakes
pull-kubevirt-conformance-arm64 108d5de link false /test pull-kubevirt-conformance-arm64

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.

@fossedihelm
Copy link
Contributor Author

/retest-required

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot kubevirt-bot merged commit fa25a88 into kubevirt:main Apr 11, 2024
36 of 38 checks passed
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. area/virtctl dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants