@@ -2,13 +2,15 @@ package main
2
2
3
3
import (
4
4
"bufio"
5
+ "fmt"
5
6
"os"
6
7
"path/filepath"
7
8
"text/template"
8
9
)
9
10
10
11
type driverConfig struct {
11
12
StorageClassFile string
13
+ Capabilities []string
12
14
}
13
15
14
16
const (
@@ -19,7 +21,7 @@ const (
19
21
20
22
// generateDriverConfigFile loads a testdriver config template and creates a file
21
23
// with the test-specific configuration
22
- func generateDriverConfigFile (pkgDir , storageClassFile string ) (string , error ) {
24
+ func generateDriverConfigFile (pkgDir , storageClassFile , deploymentStrat string ) (string , error ) {
23
25
// Load template
24
26
t , err := template .ParseFiles (filepath .Join (pkgDir , testConfigDir , configTemplateFile ))
25
27
if err != nil {
@@ -37,9 +39,42 @@ func generateDriverConfigFile(pkgDir, storageClassFile string) (string, error) {
37
39
w := bufio .NewWriter (f )
38
40
defer w .Flush ()
39
41
40
- // Fill in template parameters
42
+ // Fill in template parameters. Capabilities can be found here:
43
+ // https://github.com/kubernetes/kubernetes/blob/b717be8269a4f381ab6c23e711e8924bc1f64c93/test/e2e/storage/testsuites/testdriver.go#L136
44
+ caps := []string {
45
+ "persistence" ,
46
+ "block" ,
47
+ "fsGroup" ,
48
+ "exec" ,
49
+ "multipods" ,
50
+ "topology" ,
51
+ }
52
+
53
+ /* Unsupported Capabilities:
54
+ snapshotDataSource
55
+ pvcDataSource
56
+ RWX
57
+ volumeLimits # PD Supports volume limits but test is very slow
58
+ singleNodeVolume
59
+ dataSource
60
+ */
61
+
62
+ // TODO: Support adding/removing capabilities based on Kubernetes version.
63
+ switch deploymentStrat {
64
+ case "gke" :
65
+ case "gce" :
66
+ // TODO: OSS K8S supports volume expansion for CSI by default in 1.16+;
67
+ // however, at time of writing GKE does not support K8S 1.16+. Add these
68
+ // capabilities for both deployment strategies when GKE Supports CSI
69
+ // Expansion by default.
70
+ caps = append (caps , "controllerExpansion" , "nodeExpansion" )
71
+ default :
72
+ return "" , fmt .Errorf ("got unknown deployment strat %s, expected gce or gke" , deploymentStrat )
73
+ }
74
+
41
75
params := driverConfig {
42
76
StorageClassFile : filepath .Join (pkgDir , testConfigDir , storageClassFile ),
77
+ Capabilities : caps ,
43
78
}
44
79
45
80
// Write config file
0 commit comments