Skip to content

Commit

Permalink
Merge pull request #865 from NVIDIA/fix-volumes-for-vgpu-manager
Browse files Browse the repository at this point in the history
[vgpu-manager] mount necessary directories so that GSP firmware can be used
  • Loading branch information
cdesiniotis authored Jul 25, 2024
2 parents bfefa4d + 270bed7 commit 7848af2
Show file tree
Hide file tree
Showing 7 changed files with 446 additions and 1 deletion.
13 changes: 12 additions & 1 deletion assets/state-vgpu-manager/0210_clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ rules:
- ""
resources:
- nodes
- pods
verbs:
- get
- list
Expand All @@ -23,6 +22,18 @@ rules:
- apiGroups:
- ""
resources:
- pods
- pods/eviction
verbs:
- create
- delete
- get
- list
- patch
- update
- apiGroups:
- apps
resources:
- daemonsets
verbs:
- get
15 changes: 15 additions & 0 deletions assets/state-vgpu-manager/0500_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ spec:
mountPath: /var/log
- name: dev-log
mountPath: /dev/log
- name: firmware-search-path
mountPath: /sys/module/firmware_class/parameters/path
- name: nv-firmware
mountPath: /lib/firmware
# Only kept when OpenShift DriverToolkit side-car is enabled.
- image: "FILLED BY THE OPERATOR"
imagePullPolicy: IfNotPresent
Expand Down Expand Up @@ -114,6 +118,10 @@ spec:
mountPath: /var/log
- name: dev-log
mountPath: /dev/log
- name: firmware-search-path
mountPath: /sys/module/firmware_class/parameters/path
- name: nv-firmware
mountPath: /lib/firmware
volumes:
- name: run-nvidia
hostPath:
Expand Down Expand Up @@ -144,3 +152,10 @@ spec:
- name: dev-log
hostPath:
path: /dev/log
- name: firmware-search-path
hostPath:
path: /sys/module/firmware_class/parameters/path
- name: nv-firmware
hostPath:
path: /run/nvidia/driver/lib/firmware
type: DirectoryOrCreate
39 changes: 39 additions & 0 deletions internal/state/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,45 @@ func TestVGPUHostManagerDaemonset(t *testing.T) {
require.Equal(t, string(o), actual)
}

func TestVGPUHostManagerDaemonsetOpenShift(t *testing.T) {
const (
testName = "driver-vgpu-host-manager-openshift"
rhcosVersion = "413.92.202304252344-0"
toolkitImage = "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:7fecaebc1d51b28bc3548171907e4d91823a031d7a6a694ab686999be2b4d867"
)
state, err := NewStateDriver(nil, nil, manifestDir)
require.Nil(t, err)
stateDriver, ok := state.(*stateDriver)
require.True(t, ok)

renderData := getMinimalDriverRenderData()
renderData.Driver.Spec.DriverType = nvidiav1alpha1.VGPUHostManager
renderData.Driver.Name = "nvidia-vgpu-manager-openshift"
renderData.Driver.AppName = "nvidia-vgpu-manager-openshift-7c6d7bd86b"
renderData.Driver.ImagePath = "nvcr.io/nvidia/vgpu-manager:525.85.03-rhel8.0"
renderData.Driver.OSVersion = "rhel8.0"
renderData.Openshift = &openshiftSpec{
ToolkitImage: toolkitImage,
RHCOSVersion: rhcosVersion,
}
renderData.Runtime.OpenshiftDriverToolkitEnabled = true
renderData.Runtime.OpenshiftVersion = "4.13"

objs, err := stateDriver.renderer.RenderObjects(
&render.TemplatingData{
Data: renderData,
})
require.Nil(t, err)

actual, err := getYAMLString(objs)
require.Nil(t, err)

o, err := os.ReadFile(filepath.Join(manifestResultDir, testName+".yaml"))
require.Nil(t, err)

require.Equal(t, string(o), actual)
}

func getMinimalDriverRenderData() *driverRenderData {
return &driverRenderData{
Driver: &driverSpec{
Expand Down
4 changes: 4 additions & 0 deletions internal/state/testdata/golden/driver-gdrcopy-openshift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ spec:
- mountPath: /host-etc/os-release
name: host-os-release
readOnly: true
- mountPath: /sys/module/firmware_class/parameters/path
name: firmware-search-path
- mountPath: /lib/firmware
name: nv-firmware
hostPID: true
imagePullSecrets:
- name: ngc-secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ spec:
- mountPath: /host-etc/os-release
name: host-os-release
readOnly: true
- mountPath: /sys/module/firmware_class/parameters/path
name: firmware-search-path
- mountPath: /lib/firmware
name: nv-firmware
hostPID: true
initContainers:
- args:
Expand Down
Loading

0 comments on commit 7848af2

Please sign in to comment.