@@ -54,6 +54,7 @@ import (
54
54
v1 "k8s.io/api/core/v1"
55
55
rbacv1 "k8s.io/api/rbac/v1"
56
56
storagev1 "k8s.io/api/storage/v1"
57
+ storagev1alpha1 "k8s.io/api/storage/v1alpha1"
57
58
apierrors "k8s.io/apimachinery/pkg/api/errors"
58
59
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
59
60
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -85,6 +86,11 @@ const (
85
86
86
87
// Prefix of the mock driver grpc log
87
88
grpcCallPrefix = "gRPCCall:"
89
+
90
+ // Parameter to use in hostpath CSI driver VolumeAttributesClass
91
+ // Must be passed to the driver via --accepted-mutable-parameter-names
92
+ hostpathCSIDriverMutableParameterName = "e2eVacTest"
93
+ hostpathCSIDriverMutableParameterValue = "test-value"
88
94
)
89
95
90
96
// hostpathCSI
@@ -209,6 +215,15 @@ func (h *hostpathCSIDriver) GetSnapshotClass(ctx context.Context, config *storag
209
215
return utils .GenerateSnapshotClassSpec (snapshotter , parameters , ns )
210
216
}
211
217
218
+ func (h * hostpathCSIDriver ) GetVolumeAttributesClass (_ context.Context , config * storageframework.PerTestConfig ) * storagev1alpha1.VolumeAttributesClass {
219
+ return storageframework .CopyVolumeAttributesClass (& storagev1alpha1.VolumeAttributesClass {
220
+ DriverName : config .GetUniqueDriverName (),
221
+ Parameters : map [string ]string {
222
+ hostpathCSIDriverMutableParameterName : hostpathCSIDriverMutableParameterValue ,
223
+ },
224
+ }, config .Framework .Namespace .Name , "e2e-vac-hostpath" )
225
+ }
226
+
212
227
func (h * hostpathCSIDriver ) PrepareTest (ctx context.Context , f * framework.Framework ) * storageframework.PerTestConfig {
213
228
// Create secondary namespace which will be used for creating driver
214
229
driverNamespace := utils .CreateDriverNamespace (ctx , f )
@@ -230,7 +245,9 @@ func (h *hostpathCSIDriver) PrepareTest(ctx context.Context, f *framework.Framew
230
245
DriverNamespace : driverNamespace ,
231
246
}
232
247
233
- o := utils.PatchCSIOptions {
248
+ patches := []utils.PatchCSIOptions {}
249
+
250
+ patches = append (patches , utils.PatchCSIOptions {
234
251
OldDriverName : h .driverInfo .Name ,
235
252
NewDriverName : config .GetUniqueDriverName (),
236
253
DriverContainerName : "hostpath" ,
@@ -246,11 +263,31 @@ func (h *hostpathCSIDriver) PrepareTest(ctx context.Context, f *framework.Framew
246
263
ProvisionerContainerName : "csi-provisioner" ,
247
264
SnapshotterContainerName : "csi-snapshotter" ,
248
265
NodeName : node .Name ,
249
- }
266
+ })
267
+
268
+ // VAC E2E HostPath patch
269
+ // Enables ModifyVolume support in the hostpath CSI driver, and adds an enabled parameter name
270
+ patches = append (patches , utils.PatchCSIOptions {
271
+ DriverContainerName : "hostpath" ,
272
+ DriverContainerArguments : []string {"--enable-controller-modify-volume=true" , "--accepted-mutable-parameter-names=e2eVacTest" },
273
+ })
274
+
275
+ // VAC E2E FeatureGate patches
276
+ // TODO: These can be removed after the VolumeAttributesClass feature is default enabled
277
+ patches = append (patches , utils.PatchCSIOptions {
278
+ DriverContainerName : "csi-provisioner" ,
279
+ DriverContainerArguments : []string {"--feature-gates=VolumeAttributesClass=true" },
280
+ })
281
+ patches = append (patches , utils.PatchCSIOptions {
282
+ DriverContainerName : "csi-resizer" ,
283
+ DriverContainerArguments : []string {"--feature-gates=VolumeAttributesClass=true" },
284
+ })
250
285
251
286
err = utils .CreateFromManifests (ctx , config .Framework , driverNamespace , func (item interface {}) error {
252
- if err := utils .PatchCSIDeployment (config .Framework , o , item ); err != nil {
253
- return err
287
+ for _ , o := range patches {
288
+ if err := utils .PatchCSIDeployment (config .Framework , o , item ); err != nil {
289
+ return err
290
+ }
254
291
}
255
292
256
293
// Remove csi-external-health-monitor-agent and
0 commit comments