Merge "changelog-webapp: Automatic token refresh, secret manager"
diff --git a/src/cmd/cos_gpu_installer/internal/commands/install.go b/src/cmd/cos_gpu_installer/internal/commands/install.go
index 2ef3611..f6a4c63 100644
--- a/src/cmd/cos_gpu_installer/internal/commands/install.go
+++ b/src/cmd/cos_gpu_installer/internal/commands/install.go
@@ -5,6 +5,7 @@
"context"
"fmt"
"io/ioutil"
+ "os"
"path/filepath"
"flag"
@@ -48,8 +49,9 @@
func (c *InstallCommand) SetFlags(f *flag.FlagSet) {
f.StringVar(&c.driverVersion, "version", "",
"The GPU driver verion to install. It will install the default GPU driver if the flag is not set explicitly.")
- f.StringVar(&c.hostInstallDir, "dir", "/var/lib/nvidia",
- "Host directory that GPU drivers should be installed to")
+ f.StringVar(&c.hostInstallDir, "host-dir", "",
+ "Host directory that GPU drivers should be installed to. "+
+ "It tries to read from the env NVIDIA_INSTALL_DIR_HOST if the flag is not set explicitly.")
f.BoolVar(&c.unsignedDriver, "allow-unsigned-driver", false,
"Whether to allow load unsigned GPU drivers. "+
"If this flag is set to true, module signing security features must be disabled on the host for driver installation to succeed. "+
@@ -91,6 +93,11 @@
log.Warning("Current kernel command line does not support unsigned kernel modules. Not enforcing kernel module signing may cause installation fail.")
}
}
+
+ // Read value from env NVIDIA_INSTALL_DIR_HOST if the flag is not set. This is to be compatible with old interface.
+ if c.hostInstallDir == "" {
+ c.hostInstallDir = os.Getenv("NVIDIA_INSTALL_DIR_HOST")
+ }
hostInstallDir := filepath.Join(hostRootPath, c.hostInstallDir)
cacher := installer.NewCacher(hostInstallDir, envReader.BuildNumber(), c.driverVersion)
if isCached, err := cacher.IsCached(); isCached && err == nil {
diff --git a/src/cmd/cos_gpu_installer/internal/installer/installer.go b/src/cmd/cos_gpu_installer/internal/installer/installer.go
index 654240c..0cb7887 100644
--- a/src/cmd/cos_gpu_installer/internal/installer/installer.go
+++ b/src/cmd/cos_gpu_installer/internal/installer/installer.go
@@ -287,13 +287,15 @@
return errors.Wrap(err, "failed to load public key")
}
}
- // Need to load modules in order due to module dependency.
gpuModules := map[string]string{
"nvidia": filepath.Join(gpuInstallDirContainer, "drivers", "nvidia.ko"),
"nvidia_uvm": filepath.Join(gpuInstallDirContainer, "drivers", "nvidia-uvm.ko"),
"nvidia_drm": filepath.Join(gpuInstallDirContainer, "drivers", "nvidia-drm.ko"),
}
- for moduleName, modulePath := range gpuModules {
+ // Need to load modules in order due to module dependency.
+ moduleNames := []string{"nvidia", "nvidia_uvm", "nvidia_drm"}
+ for _, moduleName := range moduleNames {
+ modulePath := gpuModules[moduleName]
if err := modules.LoadModule(moduleName, modulePath); err != nil {
return errors.Wrapf(err, "failed to load module %s", modulePath)
}
diff --git a/src/cmd/cos_gpu_installer/release/Dockerfile b/src/cmd/cos_gpu_installer/release/Dockerfile
index ff50c1f..ed96f29 100644
--- a/src/cmd/cos_gpu_installer/release/Dockerfile
+++ b/src/cmd/cos_gpu_installer/release/Dockerfile
@@ -13,3 +13,4 @@
COPY cos-gpu-installer /cos-gpu-installer
ENTRYPOINT ["/cos-gpu-installer"]
+CMD ["install"]
diff --git a/src/cmd/cos_gpu_installer/release/cloud_build_request.yaml b/src/cmd/cos_gpu_installer/release/cloud_build_request.yaml
index 71432f6..b5e55a2 100644
--- a/src/cmd/cos_gpu_installer/release/cloud_build_request.yaml
+++ b/src/cmd/cos_gpu_installer/release/cloud_build_request.yaml
@@ -6,10 +6,7 @@
args:
- 'build'
- '-t'
- - 'gcr.io/${_PROJECT_ID}/cos-gpu-installer:latest'
- - '-t'
- 'gcr.io/${_PROJECT_ID}/cos-gpu-installer:${TAG_NAME}'
- './'
images:
-- 'gcr.io/${_PROJECT_ID}/cos-gpu-installer:latest'
- 'gcr.io/${_PROJECT_ID}/cos-gpu-installer:${TAG_NAME}'