-
Notifications
You must be signed in to change notification settings - Fork 117
Add vfio-gpu profile for testing KubeVirt DRA #218
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
Open
Sreeja1725
wants to merge
3
commits into
kubernetes-sigs:main
Choose a base branch
from
Sreeja1725:kubevirt-dra-profile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| .cache/ | ||
| .config/ | ||
| vendor/ | ||
| [._]*.sw[a-p] | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # kind cluster | ||
|
|
||
| Scripts to create and delete a kind cluster for the DRA demo. | ||
|
|
||
| | File | Purpose | | ||
| | --- | --- | | ||
| | `create-cluster.sh` | Create the cluster (default `gpu` profile demo) | | ||
| | `delete-cluster.sh` | Delete the cluster | | ||
| | `kind-cluster-config-vfio.yaml` | kind config used when `VFIO_GPU=true` (PCI sysfs + `/dev/vfio` mounts) | | ||
| | `vfio-gpu-test.yaml` | ResourceClaimTemplate for the `vfio-gpu` profile | | ||
|
|
||
| Shared vfio helpers live in [`demo/scripts/vfio-kind.sh`](../../scripts/vfio-kind.sh). | ||
|
|
||
| ## Default (mock GPU profile) | ||
|
|
||
| ```bash | ||
| ./demo/build-driver.sh | ||
| ./demo/clusters/kind/create-cluster.sh | ||
| helm upgrade -i \ | ||
| --create-namespace \ | ||
| --namespace dra-example-driver \ | ||
| dra-example-driver \ | ||
| deployments/helm/dra-example-driver | ||
| ``` | ||
|
|
||
| Uses the CDI-enabled kind node image built by `demo/scripts/build-kind-image.sh` and | ||
| `demo/scripts/kind-cluster-config.yaml`. | ||
|
|
||
| ## vfio-gpu profile (`VFIO_GPU=true`) | ||
|
|
||
| **Off by default.** Set `VFIO_GPU=true` when creating the cluster to bind-mount host | ||
| PCI sysfs and `/dev/vfio` into kind nodes. This is required for the `vfio-gpu` driver | ||
| profile but does **not** install the driver — you still set `deviceProfile=vfio-gpu` in | ||
| Helm separately. | ||
|
|
||
| **Linux host only.** The host must already have devices bound to `vfio-pci` before | ||
| cluster creation. The script verifies bindings and exits if none are found. | ||
|
|
||
| ### Host setup | ||
|
|
||
| Synthetic devices for testing come from [kubevirt's kind-1.35-vfio-gpu provider](https://github.com/kubevirt/kubevirt/tree/main/kubevirtci/cluster-up/cluster/kind-1.35-vfio-gpu): | ||
|
|
||
| It has not merged yet - https://github.com/kubevirt/kubevirtci/pull/1726 | ||
|
|
||
| ```bash | ||
| sudo bash setup-host-vfio-pci.sh | ||
| ls /sys/bus/pci/drivers/vfio-pci/ # expect BDF entries | ||
| ``` | ||
|
|
||
| Real hardware bound to vfio-pci works equally well. | ||
|
|
||
| ### Cluster + driver | ||
|
|
||
| ```bash | ||
| # 1. Cluster (vfio mounts into nodes) | ||
| VFIO_GPU=true ./demo/clusters/kind/create-cluster.sh | ||
|
|
||
| # 2. Driver image (build from this repo; published images may predate vfio-gpu) | ||
| ./demo/build-driver.sh | ||
|
|
||
| # 3. Driver install (vfio-gpu profile) | ||
| helm upgrade --install \ | ||
| --create-namespace \ | ||
| --namespace dra-example-driver-vfio \ | ||
| --set deviceProfile=vfio-gpu \ | ||
| --set kubeletPlugin.enableDeviceMetadata=true \ | ||
| --set driverName=vfio-gpu.example.com \ | ||
| dra-example-driver-vfio \ | ||
| deployments/helm/dra-example-driver | ||
|
|
||
| Verify the driver: | ||
|
|
||
| ```bash | ||
| kubectl -n dra-example-driver-vfio get ds -o jsonpath='{range .spec.template.spec.containers[?(@.name=="plugin")].env[?(@.name=="DEVICE_PROFILE")]}{.value}{"\n"}{end}' | ||
| kubectl get resourceslices -o custom-columns='NAME:.metadata.name,DRIVER:.spec.driver,NODE:.spec.nodeName' | ||
| ``` | ||
|
|
||
| Tear down: | ||
|
|
||
| ```bash | ||
| ./demo/clusters/kind/delete-cluster.sh | ||
| ``` | ||
|
|
||
| ### Environment variables | ||
|
|
||
| | Variable | Default | Purpose | | ||
| | --- | --- | --- | | ||
| | `VFIO_GPU` | `false` | Enable vfio-gpu cluster mode (`true` / `1` / `yes` / `on`) | | ||
| | `VFIO_KIND_NODE_IMAGE` | pinned `kindest/node:v1.35.0` | kind node image when `VFIO_GPU=true` | | ||
| | `VFIO_KIND_CLUSTER_CONFIG_PATH` | `kind-cluster-config-vfio.yaml` in this directory | kind config when `VFIO_GPU=true` | | ||
|
|
||
| Other variables (`KIND_CLUSTER_NAME`, `CONTAINER_TOOL`, …) come from [`demo/scripts/common.sh`](../../scripts/common.sh). | ||
|
|
||
| ### Two knobs (cluster vs driver) | ||
|
|
||
| | Setting | Layer | What it does | | ||
| | --- | --- | --- | | ||
| | `VFIO_GPU=true` | Cluster (`create-cluster.sh`) | vfio-pci preflight, vfio kind config, post-create node setup | | ||
| | `deviceProfile=vfio-gpu` | Driver (Helm) | Driver discovers vfio-bound PCI devices and prepares `/dev/vfio` CDI | | ||
|
|
||
| Both are required for the end-to-end vfio-gpu demo. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.