@@ -15,17 +15,17 @@ func getOverlayDir(pkgDir, deployOverlayName string) string {
15
15
return filepath .Join (pkgDir , "deploy" , "kubernetes" , "overlays" , deployOverlayName )
16
16
}
17
17
18
- func installDriver (platform , goPath , pkgDir , stagingImage , stagingVersion , deployOverlayName string , doDriverBuild bool ) error {
18
+ func installDriver (testParams * testParameters , stagingImage , deployOverlayName string , doDriverBuild bool ) error {
19
19
if doDriverBuild {
20
20
// Install kustomize
21
21
klog .Infof ("Installing kustomize" )
22
- out , err := exec .Command (filepath .Join (pkgDir , "deploy" , "kubernetes" , "install-kustomize.sh" )).CombinedOutput ()
22
+ out , err := exec .Command (filepath .Join (testParams . pkgDir , "deploy" , "kubernetes" , "install-kustomize.sh" )).CombinedOutput ()
23
23
if err != nil {
24
24
return fmt .Errorf ("failed to install kustomize: %s, err: %v" , out , err )
25
25
}
26
26
27
27
// Edit ci kustomization to use given image tag
28
- overlayDir := getOverlayDir (pkgDir , deployOverlayName )
28
+ overlayDir := getOverlayDir (testParams . pkgDir , deployOverlayName )
29
29
err = os .Chdir (overlayDir )
30
30
if err != nil {
31
31
return fmt .Errorf ("failed to change to overlay directory: %s, err: %v" , out , err )
@@ -34,11 +34,11 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
34
34
// TODO (#138): in a local environment this is going to modify the actual kustomize files.
35
35
// maybe a copy should be made instead
36
36
out , err = exec .Command (
37
- filepath .Join (pkgDir , "bin" , "kustomize" ),
37
+ filepath .Join (testParams . pkgDir , "bin" , "kustomize" ),
38
38
"edit" ,
39
39
"set" ,
40
40
"image" ,
41
- fmt .Sprintf ("%s=%s:%s" , pdImagePlaceholder , stagingImage , stagingVersion )).CombinedOutput ()
41
+ fmt .Sprintf ("%s=%s:%s" , pdImagePlaceholder , stagingImage , testParams . stagingVersion )).CombinedOutput ()
42
42
if err != nil {
43
43
return fmt .Errorf ("failed to edit kustomize: %s, err: %v" , out , err )
44
44
}
@@ -61,9 +61,9 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
61
61
}
62
62
63
63
// deploy driver
64
- deployCmd := exec .Command (filepath .Join (pkgDir , "deploy" , "kubernetes" , "deploy-driver.sh" ), "--skip-sa-check" )
64
+ deployCmd := exec .Command (filepath .Join (testParams . pkgDir , "deploy" , "kubernetes" , "deploy-driver.sh" ), "--skip-sa-check" )
65
65
deployEnv = append (deployEnv ,
66
- fmt .Sprintf ("GOPATH=%s" , goPath ),
66
+ fmt .Sprintf ("GOPATH=%s" , testParams . goPath ),
67
67
fmt .Sprintf ("GCE_PD_DRIVER_VERSION=%s" , deployOverlayName ))
68
68
deployEnv = append (os .Environ (), deployEnv ... )
69
69
deployCmd .Env = deployEnv
@@ -72,14 +72,14 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
72
72
return fmt .Errorf ("failed to deploy driver: %w" , err )
73
73
}
74
74
75
- waitScript := filepath .Join (pkgDir , "deploy" , "kubernetes" , "wait-for-driver.sh" )
75
+ waitScript := filepath .Join (testParams . pkgDir , "deploy" , "kubernetes" , "wait-for-driver.sh" )
76
76
waitCmd := exec .Command (waitScript )
77
77
waitCmd .Env = deployEnv
78
78
err = runCommand ("Waiting for driver to start" , waitCmd )
79
79
if err != nil {
80
80
return fmt .Errorf ("driver failed to come up: %w" , err )
81
81
}
82
- if platform == "windows" {
82
+ if testParams . platform == "windows" {
83
83
waitCmd = exec .Command (waitScript , "--windows" )
84
84
waitCmd .Env = deployEnv
85
85
err = runCommand ("Waiting for windows deployment to start" , waitCmd )
@@ -91,15 +91,15 @@ func installDriver(platform, goPath, pkgDir, stagingImage, stagingVersion, deplo
91
91
klog .Infof ("describe pods \n %s" , string (out ))
92
92
93
93
if err != nil {
94
- return fmt .Errorf ("failed to describe pods: %v " , err )
94
+ return fmt .Errorf ("failed to describe pods: %w " , err )
95
95
}
96
96
return nil
97
97
}
98
98
99
- func deleteDriver (goPath , pkgDir , deployOverlayName string ) error {
100
- deleteCmd := exec .Command (filepath .Join (pkgDir , "deploy" , "kubernetes" , "delete-driver.sh" ))
99
+ func deleteDriver (testParams * testParameters , deployOverlayName string ) error {
100
+ deleteCmd := exec .Command (filepath .Join (testParams . pkgDir , "deploy" , "kubernetes" , "delete-driver.sh" ))
101
101
deleteCmd .Env = append (os .Environ (),
102
- fmt .Sprintf ("GOPATH=%s" , goPath ),
102
+ fmt .Sprintf ("GOPATH=%s" , testParams . goPath ),
103
103
fmt .Sprintf ("GCE_PD_DRIVER_VERSION=%s" , deployOverlayName ),
104
104
)
105
105
err := runCommand ("Deleting driver" , deleteCmd )
0 commit comments