Skip to content

Commit d25b7f8

Browse files
authored
Merge pull request #18098 from rifelpet/gcp-pd-e2e
Enable E2E external CSI testing on GCP
2 parents 93887f9 + 14dbafd commit d25b7f8

3 files changed

Lines changed: 61 additions & 8 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Manifest for Kubernetes external tests.
2+
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external
3+
4+
ShortName: gcp-pd
5+
StorageClass:
6+
FromFile: tests/e2e/csi-manifests/gcp-pd/sc.yaml
7+
# kOps does not install snapshotClass by default
8+
#SnapshotClass:
9+
# FromFile: snapshotclass.yaml
10+
DriverInfo:
11+
Name: pd.csi.storage.gke.io
12+
SupportedSizeRange:
13+
Min: 1Gi
14+
Max: 16Ti
15+
SupportedFsType:
16+
xfs: {}
17+
ext4: {}
18+
SupportedMountOption:
19+
dirsync: {}
20+
TopologyKeys: ["topology.gke.io/zone"]
21+
Capabilities:
22+
persistence: true
23+
fsGroup: true
24+
block: true
25+
exec: true
26+
snapshotDataSource: false
27+
pvcDataSource: false
28+
multipods: true
29+
controllerExpansion: true
30+
nodeExpansion: true
31+
volumeLimits: false
32+
topology: true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: balanced-csi
5+
allowVolumeExpansion: true
6+
parameters:
7+
type: pd-balanced
8+
provisioner: pd.csi.storage.gke.io
9+
reclaimPolicy: Delete
10+
volumeBindingMode: WaitForFirstConsumer

tests/e2e/pkg/tester/tester.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,21 +421,32 @@ func (t *Tester) addCSIDriverFlags() error {
421421
return err
422422
}
423423

424-
if cluster.Spec.CloudConfig != nil &&
425-
cluster.Spec.CloudConfig.AWSEBSCSIDriver != nil &&
426-
cluster.Spec.CloudConfig.AWSEBSCSIDriver.Enabled != nil &&
427-
*cluster.Spec.CloudConfig.AWSEBSCSIDriver.Enabled {
424+
var driverFlags string
425+
if cluster.Spec.CloudConfig != nil {
428426
cwd, err := os.Getwd()
429427
if err != nil {
430428
return err
431429
}
432-
klog.Infof("Setting --storage.testdriver=%s/tests/e2e/csi-manifests/ebs.yaml --storage.migratedPlugins=kubernetes.io/aws-ebs", cwd)
433-
t.TestArgs += fmt.Sprintf(" --storage.testdriver=%s/tests/e2e/csi-manifests/aws-ebs/driver.yaml --storage.migratedPlugins=kubernetes.io/aws-ebs", cwd)
430+
431+
switch {
432+
case cluster.Spec.CloudConfig.AWSEBSCSIDriver != nil &&
433+
cluster.Spec.CloudConfig.AWSEBSCSIDriver.Enabled != nil &&
434+
*cluster.Spec.CloudConfig.AWSEBSCSIDriver.Enabled:
435+
driverFlags = fmt.Sprintf(" --storage.testdriver=%s/tests/e2e/csi-manifests/aws-ebs/driver.yaml --storage.migratedPlugins=kubernetes.io/aws-ebs", cwd)
436+
case cluster.Spec.CloudConfig.GCPPDCSIDriver != nil &&
437+
cluster.Spec.CloudConfig.GCPPDCSIDriver.Enabled != nil &&
438+
*cluster.Spec.CloudConfig.GCPPDCSIDriver.Enabled:
439+
driverFlags = fmt.Sprintf(" --storage.testdriver=%s/tests/e2e/csi-manifests/gcp-pd/driver.yaml --storage.migratedPlugins=kubernetes.io/gce-pd", cwd)
440+
}
441+
}
442+
443+
if driverFlags != "" {
444+
klog.Infof("Setting %v", driverFlags)
445+
t.TestArgs += driverFlags
434446
} else {
435-
klog.Info("EBS CSI driver not enabled. Skipping tests")
447+
klog.Info("CSI driver not enabled. Skipping tests")
436448
}
437449
return nil
438-
439450
}
440451

441452
func (t *Tester) execute() error {

0 commit comments

Comments
 (0)