Add driver rootfs and /host to vgpu-device-manager#1474
Add driver rootfs and /host to vgpu-device-manager#1474tariq1890 merged 1 commit intoNVIDIA:mainfrom
Conversation
|
/cc @cdesiniotis |
| hostPath: | ||
| path: /run/nvidia/validations | ||
| type: DirectoryOrCreate | ||
| - name: mig-parted-config |
There was a problem hiding this comment.
Instead of adding these two configMap references here, we could just update the unmarshaled ConfigMap object with these configMap references when we detect that the clusterpolicy custom resource includes additional configMaps
There was a problem hiding this comment.
Thank you for pointing this out, it slipped my TODOs when drafting this PR. What do you think about implementing the same logic found in the respective MIG Manager transformation?
I also tried to reduce the duplicate checks that came up, but let me know if you think that's less readable and/or not maintainable and I'll go back to simple checks.
There was a problem hiding this comment.
Is this comment still relevant?
There was a problem hiding this comment.
We have removed both the mig-parted-config and the gpu-clients ConfigMaps, as neither is currently relevant to these changes.
mig-parted-config is not needed since the vgpu-device-manager handles the conversion of of the vGPU config to the respective MIG config.
gpu-clients is not needed since there is currently no support for pre-installed vGPU host drivers, which is the purpose of this ConfigMap in the first place.
Thank you both for the detailed explanations and suggestions!
8e36bda to
51d9d07
Compare
ae945ae to
b9b9b60
Compare
| - name: LD_PRELOAD | ||
| value: "/driver-root/usr/lib64/libnvidia-ml.so.1" |
There was a problem hiding this comment.
Ideally we wouldn't set this in the spec. Instead, we would discover the path to libnvidia-ml.so.1 in the vgpu-device-manager code and set the LD_PRELOAD envvar when invoking the mig-parted binaries. We have precedent for this in other components. For example, here is our code in the gpu-operator-validator that validates a driver container installation:
gpu-operator/cmd/nvidia-validator/main.go
Lines 731 to 749 in 6324d2a
There was a problem hiding this comment.
This makes sense, thank you for pointing out the use of such code in other components. I refactored the vgpu-device-manager PR to search for the library and setup LD_PRELOAD for the mig-parted commands.
9e8e269 to
ea05313
Compare
controllers/object_controls.go
Outdated
| if config.MIGManager.Config != nil && config.MIGManager.Config.Name != "" && config.MIGManager.Config.Name != MigPartedDefaultConfigMapName { | ||
| logger.Info(fmt.Sprintf("Not creating resource, custom ConfigMap provided: %s", config.MIGManager.Config.Name)) | ||
| if name, isCustom := gpuv1.GetConfigMapName(config.MIGManager.Config, MigPartedDefaultConfigMapName); isCustom { | ||
| logger.Info(fmt.Sprintf("Not creating resource, custom ConfigMap provided: %s", name)) |
There was a problem hiding this comment.
We don't need fmt.Sprintf as logger.Info already supports formatted messages
See the method signature below
func (l Logger) Info(msg string, keysAndValues ...any) {
if l.sink == nil {
return
}
if l.sink.Enabled(l.level) { // see comment in Enabled
if withHelper, ok := l.sink.(CallStackHelperLogSink); ok {
withHelper.GetCallStackHelper()()
}
l.sink.Info(l.level, msg, keysAndValues...)
}
}
There was a problem hiding this comment.
This is an example of a logger.Info() call
w.log.Info("Operands are disabled for node", "NodeName", w.node, "Label", commonOperandsLabelKey, "Value", "false")
There was a problem hiding this comment.
Thanks for pointing that out and the detailed explanation! I blindly followed the existing log message. I have updated these changes.
controllers/object_controls.go
Outdated
|
|
||
| // set ConfigMap name for "gpu-clients" Volume | ||
| for i, vol := range obj.Spec.Template.Spec.Volumes { | ||
| if !strings.Contains(vol.Name, "gpu-clients") { |
There was a problem hiding this comment.
I'd prefer an exact string match instead of a Contains
There was a problem hiding this comment.
I can definitely update this, I just wasn't sure about why Contains is used in other such cases, e.g. here and thought I'd adhere to what is already used.
There was a problem hiding this comment.
No good reason AFAIK. Someone probably made the decision to use Contains a while ago and it just stuck throughout. We can update the conditional here to check for an exact string match.
b8c7421 to
205e07f
Compare
controllers/object_controls.go
Outdated
| break | ||
| } | ||
|
|
||
| // set ConfigMap name for "gpu-clients" Volume |
There was a problem hiding this comment.
A general question / comment - what happens if the MIG Manager component is explicitly disabled in ClusterPolicy? In this case, the default-gpu-clients ConfigMap would not have been created by the GPU Operator, and thus, the vGPU Device Manager would fail to run (due to the missing volume).
We don't have any precedent for this (so I am not sure if there are any adverse effects), but what about creating a symlink to the default-gpu-clients ConfigMap contents?
assets/state-vgpu-device-manager/0510_configmap.yaml --> assets/state-mig-manager/0410_configmap.yaml
This way, when reconciling the vGPU Device Manager component, the GPU Operator will always attempt to create the default-gpu-clients ConfigMap when the user has not specified a custom ConfigMap -- regardless if the MIG Manager is enabled or not.
There was a problem hiding this comment.
Thinking about this more, a symlink will not work. If the MIG Manager OR vGPU Device Manager is disabled in ClusterPolicy, the ConfigMap will get deleted here:
gpu-operator/controllers/object_controls.go
Lines 527 to 534 in 1d56b20
We might need to add a copy of this ConfigMap in assets/state-vgpu-device-manager (same contents, different name) unless one of us thinks of a more clever solution.
There was a problem hiding this comment.
One thing to note, the gpu-clients configuration file is only relevant when drivers are pre-installed on the host (not installed via the driver container) -- the gpu-clients configuration file contains a list of systemd services that use the GPU and need to be restarted across a MIG re-configuration.
We technically don't support pre-installed vGPU manager (aka the host driver) today. This becomes apparent when reading this code snippet / TODO item: https://github.com/NVIDIA/gpu-operator/blob/main/assets/state-vgpu-device-manager/0600_daemonset.yaml#L25-L28
Because we don't support pre-installed vGPU Manager, I would be open to removing the gpu-clients configuration handling from this PR entirely. It may be more appropriate to add the gpu-clients configuration handling in the same PR that adds preinstalled vGPU Manager support (whenever this becomes a requirement and prioritized).
There was a problem hiding this comment.
Thank you very much for the detailed explanation! I agree with you that we should not include the gpu-clients ConfigMap as it's not currently relevant. I have updated the PR accordingly.
controllers/object_controls.go
Outdated
|
|
||
| // set ConfigMap name for "gpu-clients" Volume | ||
| for i, vol := range obj.Spec.Template.Spec.Volumes { | ||
| if !strings.Contains(vol.Name, "gpu-clients") { |
There was a problem hiding this comment.
No good reason AFAIK. Someone probably made the decision to use Contains a while ago and it just stuck throughout. We can update the conditional here to check for an exact string match.
4aa0825 to
cc107ac
Compare
|
/ok to test cc107ac |
cc107ac to
70662bb
Compare
|
/ok to test 70662bb |
|
@tariq1890 can you take another look at this PR? |
|
Can you rebase this PR @mresvanis ? |
70662bb to
5385337
Compare
This change enables the vgpu-device-manager to run nvidia-mig-parted to configure MIG when MIG-backed vGPU types are included in the selected vGPU configuration before applying the latter. nvidia-mig-parted requires NVML to configure MIG and /host to start/stop systemd services. Signed-off-by: Michail Resvanis <mresvani@redhat.com>
5385337 to
04bb02f
Compare
|
/ok to test 04bb02f |
This PR mounts the NVIDIA driver rootfs, the host rootfs and the
gpu-clientsConfigMap to thevgpu-device-managercontainer to enable MIG configuration before the vGPU configuration when MIG-backed vGPU types are included in the selected vGPU configuration.nvidia-mig-partedrequires NVML to configure MIG and the host rootfs to start/stop systemd services.Related vGPU device manager PR: NVIDIA/vgpu-device-manager#93