-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'hostPaths.driverInstallDir' field to ClusterPolicy
This allows for non-standard driver container installations, where the driver installation path and device nodes are rooted at paths other than '/run/nvidia/driver'. Note, setting driverInstallDir to a custom value is currently only supported for driver container installations not managed by by GPU Operator. For example, in the GKE use case where a driver daemonset is deployed prior to installing GPU Operator and the GPU Operator managed driver is disabled. The GPU Operator's driver container daemonset still assumes that the full driver installation is made available at '/run/nvidia/driver' on the host, and consequently, we always mount '/run/nvidia/driver' into the GPU Operator managed daemonset. We may consider removing this assumption in the future and support driver container implementations which allow for a custom driverInstallDir to be specified. Signed-off-by: Christopher Desiniotis <[email protected]>
- Loading branch information
1 parent
8e4021c
commit d53e3e3
Showing
12 changed files
with
324 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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,73 @@ | ||
/* | ||
# Copyright 2024 NVIDIA CORPORATION | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
// driverInfo contains information about an NVIDIA driver installation. | ||
// | ||
// isHostDriver indicates whether the driver is installed directly on | ||
// the host at the host's root filesystem. | ||
// | ||
// hostRoot represents the host's root filesystem (typically '/'). | ||
// | ||
// driverRoot and devRoot represent the absolute paths of the driver install | ||
// and NVIDIA device nodes on the host. | ||
// | ||
// driverRootCtrPath and devRootCtrPath represent the paths of the driver install | ||
// and NVIDIA device nodes in the management containers that require them, like | ||
// the Toolkit Container, the Device Plugin, and MIG Manager. | ||
type driverInfo struct { | ||
isHostDriver bool | ||
hostRoot string | ||
driverRoot string | ||
driverRootCtrPath string | ||
devRoot string | ||
devRootCtrPath string | ||
} | ||
|
||
func getDriverInfo(isHostDriver bool, hostRoot string, driverInstallDir string, driverInstallDirCtrPath string) driverInfo { | ||
if isHostDriver { | ||
return driverInfo{ | ||
isHostDriver: true, | ||
hostRoot: hostRoot, | ||
driverRoot: hostRoot, | ||
driverRootCtrPath: "/host", | ||
devRoot: hostRoot, | ||
devRootCtrPath: "/host", | ||
} | ||
} | ||
|
||
// For drivers not installed directly on the host, devRoot can either be | ||
// hostRoot or driverInstallDir | ||
var devRoot, devRootCtrPath string | ||
devRoot = root(driverInstallDirCtrPath).getDevRoot() | ||
if devRoot == "/" { | ||
devRoot = hostRoot | ||
devRootCtrPath = "/host" | ||
} else { | ||
devRoot = driverInstallDir | ||
devRootCtrPath = "/driver-root" | ||
} | ||
|
||
return driverInfo{ | ||
isHostDriver: false, | ||
hostRoot: hostRoot, | ||
driverRoot: driverInstallDir, | ||
driverRootCtrPath: "/driver-root", | ||
devRoot: devRoot, | ||
devRootCtrPath: devRootCtrPath, | ||
} | ||
} |
This file contains 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
Oops, something went wrong.