Skip to content

Commit

Permalink
vGPU implementation - follow-up
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Jul 10, 2024
1 parent 9207847 commit a8cc7de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,21 @@ type PCIDeviceSpec struct {
// virtual machine is cloned.
// Mutually exclusive with VGPUProfile as VGPUProfile and DeviceID + VendorID
// are two independent ways to define PCI devices.
// +kubebuilder:validation:Required
// +optional
DeviceID *int32 `json:"deviceId,omitempty"`
// VendorId is the vendor ID of a virtual machine's PCI, in integer.
// Defaults to the eponymous property value in the template from which the
// virtual machine is cloned.
// Mutually exclusive with VGPUProfile as VGPUProfile and DeviceID + VendorID
// are two independent ways to define PCI devices.
// +kubebuilder:validation:Required
// +optional
VendorID *int32 `json:"vendorId,omitempty"`
// VGPUProfile is the profile name of a virtual machine's vGPU, in string.
// Defaults to the eponymous property value in the template from which the
// virtual machine is cloned.
// Mutually exclusive with DeviceID and VendorID as VGPUProfile and DeviceID + VendorID
// are two independent ways to define PCI devices.
// +kubebuilder:validation:Required
// +optional
VGPUProfile string `json:"vGPUProfile,omitempty"`
// CustomLabel is the hardware label of a virtual machine's PCI device.
// Defaults to the eponymous property value in the template from which the
Expand Down
5 changes: 2 additions & 3 deletions docs/gpu-vgpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ We are using NVIDIA Tesla V100 32GB cards for this example and will use the `gri
### Create the cluster template
```shell
$ make dev-flavors
go run ./packaging/flavorgen --output-dir /home/user/.cluster-api/overrides/infrastructure-vsphere/v0.0.0
$ make release-flavors
```
Edit the generated Cluster template (`cluster-template.yaml`) to set the values for the `pciDevices` array. Here we are editing the VSphereMachineTemplate object for the worker nodes. This will create a worker node with a single NVIDIA 16GB vGPU device attached to the VM.
Edit the generated Cluster template (e.g. `out/cluster-template.yaml`) to set the values for the `pciDevices` array. Here we are editing the VSphereMachineTemplate object for the worker nodes. This will create a worker node with a single NVIDIA 16GB vGPU device attached to the VM.
```yaml
---
Expand Down
2 changes: 1 addition & 1 deletion internal/webhooks/vspheremachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func validatePCIDevices(devices []infrav1.PCIDeviceSpec) field.ErrorList {
// Valid case for PCI Passthrough.
continue
}
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "template", "spec", "pciDevices", fmt.Sprintf("%d", i)), device, "should have either deviceId + vendorId or vGPUProfile set"))
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "template", "spec", "pciDevices").Index(i), device, "should have either deviceId + vendorId or vGPUProfile set"))
}
return allErrs
}

0 comments on commit a8cc7de

Please sign in to comment.