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

Add support for ResourceClaim in HostDevices #12533

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TheRealSibasishBehera
Copy link
Contributor

@TheRealSibasishBehera TheRealSibasishBehera commented Aug 6, 2024

What this PR does

Before this PR:

virt-handler (which uses device plugin framework) is used to allocate PCI devices to the VM .
User needed to configure the KubeVirtCR and add the device name in the VM manifest as mentioned in
nvme-pci-passthrough

After this PR:

DRA framerwork , along with a separate DRA driver which supports PCI devices , would be used for allocating and managing PCI host devices .

Users would have a option to use ResourceClaim for their host devices by enabling "DynamicResourceAllocation" feature gate .

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:

kubevirt/community#254

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

NONE

This patch introduces the ResourceClaim for HostDevices and also adds the 'DynamicResourceAllocation' feature gate, which must be enabled to utilize ResourceClaim.

After the DRA driver for host devices is configured and deployed , the user needs to add the ClaimParameters and ResourceClaim or ResourceClaimTemplate by following a configuration similar to this :

ClaimParameters
-----
apiVersion: pci.resource.kubevirt.io/v1alpha1
kind: PciClaimParameters
metadata:
  name: nvme-params
  namespace: pci-nvme-test1
spec:
  count: 1
  deviceName: "devices.kubevirt.io/nvme"

ResourceClaim
-----
apiVersion: resource.k8s.io/v1alpha2
kind: ResourceClaim
metadata:
  namespace: pci-nvme-test1
  name: test-pci-claim
spec:
  resourceClassName: pci.kubevirt.io
  parametersRef:
    apiGroup: pci.resource.kubevirt.io
    kind: PciClaimParameters
    name: nvme-params

Note: the above information is specific to how DRA driver is configured

The user that wants to create a VM with said USB device can do so with the following configuration:
In a VMI
--------
spec:
  domain:
    devices:
      hostDevices:
      - name: nvme1
        deviceName: devices.kubevirt.io/nvme  # <- same as ClaimParameters
        resourceClaim:
          name: pci-test
          source:
            resourceClaimName: test-pci-claim

Signed-off-by: TheRealSibasishBehera <fangedhamster3114@gmail.com>
…er pod

Signed-off-by: TheRealSibasishBehera <fangedhamster3114@gmail.com>
@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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 6, 2024
@kubevirt-bot
Copy link
Contributor

Hi @TheRealSibasishBehera. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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-sigs/prow repository.

@kubevirt-bot kubevirt-bot added size/XL area/instancetype kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/compute labels Aug 6, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign stu-gott for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 6, 2024
@maiqueb
Copy link
Contributor

maiqueb commented Aug 6, 2024

/cc

@alicefr
Copy link
Member

alicefr commented Aug 8, 2024

/cc @alicefr @victortoso

@alicefr
Copy link
Member

alicefr commented Aug 8, 2024

@TheRealSibasishBehera please remove the last merge commit

@@ -0,0 +1,61 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

The examples are generated from code. So, this fine to give an example, but it will be removed by the automatic tooling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see . Is the code generation tool part of kubevirt ?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/instancetype dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API release-note-none Denotes a PR that doesn't merit a release note. sig/compute size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants