Skip to content

Commit

Permalink
Merge pull request #1180 from NVIDIA/wsl
Browse files Browse the repository at this point in the history
Changes required for WSL2
  • Loading branch information
cdesiniotis authored Jan 14, 2025
2 parents 39978ef + 13a384f commit 13b9b0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/gpu-feature-discovery/0500_daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ spec:
volumeMounts:
- name: output-dir
mountPath: "/etc/kubernetes/node-feature-discovery/features.d"
- name: dmi-info-dir
mountPath: "/sys/class/dmi/id"
- name: host-sys
mountPath: /sys
readOnly: true
- name: config
mountPath: /config
Expand Down Expand Up @@ -169,9 +169,9 @@ spec:
- name: output-dir
hostPath:
path: "/etc/kubernetes/node-feature-discovery/features.d"
- name: dmi-info-dir
- name: host-sys
hostPath:
path: "/sys/class/dmi/id"
path: /sys
- name: run-nvidia-validations
hostPath:
path: "/run/nvidia/validations"
Expand Down
7 changes: 7 additions & 0 deletions validator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ const (
CCCapableLabelKey = "nvidia.com/cc.capable"
// appComponentLabelKey indicates the label key of the component
appComponentLabelKey = "app.kubernetes.io/component"
// wslNvidiaSMIPath indicates the path to the nvidia-smi binary on WSL
wslNvidiaSMIPath = "/usr/lib/wsl/lib/nvidia-smi"
)

func main() {
Expand Down Expand Up @@ -693,6 +695,11 @@ func isDriverManagedByOperator(ctx context.Context) (bool, error) {

func validateHostDriver(silent bool) error {
log.Info("Attempting to validate a pre-installed driver on the host")
if fileInfo, err := os.Lstat(filepath.Join("/host", wslNvidiaSMIPath)); err == nil && fileInfo.Size() != 0 {
log.Infof("WSL2 system detected, assuming driver is pre-installed")
disableDevCharSymlinkCreation = true
return nil
}
fileInfo, err := os.Lstat("/host/usr/bin/nvidia-smi")
if err != nil {
return fmt.Errorf("no 'nvidia-smi' file present on the host: %w", err)
Expand Down

0 comments on commit 13b9b0d

Please sign in to comment.