@@ -56,25 +56,29 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
5656 }
5757 }
5858
59- // setup service account file for secret creation
60- tmpSaFile := filepath .Join (generateUniqueTmpDir (), "cloud-sa.json" )
61- defer removeDir (filepath .Dir (tmpSaFile ))
59+ var deployEnv []string
60+ if deployOverlayName != "noauth" {
61+ // setup service account file for secret creation
62+ tmpSaFile := filepath .Join (generateUniqueTmpDir (), "cloud-sa.json" )
63+ defer removeDir (filepath .Dir (tmpSaFile ))
64+
65+ // Need to copy it to name the file "cloud-sa.json"
66+ out , err := exec .Command ("cp" , * saFile , tmpSaFile ).CombinedOutput ()
67+ if err != nil {
68+ return fmt .Errorf ("error copying service account key: %s, err: %v" , out , err )
69+ }
70+ defer shredFile (tmpSaFile )
6271
63- // Need to copy it to name the file "cloud-sa.json"
64- out , err := exec .Command ("cp" , * saFile , tmpSaFile ).CombinedOutput ()
65- if err != nil {
66- return fmt .Errorf ("error copying service account key: %s, err: %v" , out , err )
72+ deployEnv = append (deployEnv , fmt .Sprintf ("GCE_PD_SA_DIR=%s" , filepath .Dir (tmpSaFile )))
6773 }
68- defer shredFile (tmpSaFile )
6974
7075 // deploy driver
7176 deployCmd := exec .Command (filepath .Join (pkgDir , "deploy" , "kubernetes" , "deploy-driver.sh" ), "--skip-sa-check" )
72- deployCmd . Env = append (os . Environ () ,
77+ deployEnv = append (deployEnv ,
7378 fmt .Sprintf ("GOPATH=%s" , goPath ),
74- fmt .Sprintf ("GCE_PD_SA_DIR=%s" , filepath .Dir (tmpSaFile )),
75- fmt .Sprintf ("GCE_PD_DRIVER_VERSION=%s" , deployOverlayName ),
76- )
77- err = runCommand ("Deploying driver" , deployCmd )
79+ fmt .Sprintf ("GCE_PD_DRIVER_VERSION=%s" , deployOverlayName ))
80+ deployCmd .Env = append (os .Environ (), deployEnv ... )
81+ err := runCommand ("Deploying driver" , deployCmd )
7882 if err != nil {
7983 return fmt .Errorf ("failed to deploy driver: %v" , err )
8084 }
@@ -87,7 +91,7 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
8791 klog .Infof ("Waiting 5 minutes for the driver to start on Linux" )
8892 time .Sleep (5 * time .Minute )
8993 }
90- out , err = exec .Command ("kubectl" , "describe" , "pods" , "-n" , driverNamespace ).CombinedOutput ()
94+ out , err : = exec .Command ("kubectl" , "describe" , "pods" , "-n" , driverNamespace ).CombinedOutput ()
9195 klog .Infof ("describe pods \n %s" , string (out ))
9296
9397 if err != nil {
0 commit comments