@@ -277,6 +277,14 @@ type CSIDriverSpec struct {
277
277
// +optional
278
278
AttachRequired * bool
279
279
280
+ // Defines if the underlying volume supports changing ownership and
281
+ // permission of the volume before being mounted.
282
+ // Refer to the specific FSGroupPolicy values for additional details.
283
+ // This field is alpha-level, and is only honored by servers
284
+ // that enable the CSIVolumeFSGroupPolicy feature gate.
285
+ // +optional
286
+ FSGroupPolicy * FSGroupPolicy
287
+
280
288
// If set to true, podInfoOnMount indicates this CSI volume driver
281
289
// requires additional pod information (like podName, podUID, etc.) during
282
290
// mount operations.
@@ -331,6 +339,37 @@ type CSIDriverSpec struct {
331
339
StorageCapacity * bool
332
340
}
333
341
342
+ // FSGroupPolicy specifies if a CSI Driver supports modifying
343
+ // volume ownership and permissions of the volume to be mounted.
344
+ // More modes may be added in the future.
345
+ type FSGroupPolicy string
346
+
347
+ const (
348
+ // ReadWriteOnceWithFSTypeFSGroupPolicy indicates that each volume will be examined
349
+ // to determine if the volume ownership and permissions
350
+ // should be modified. If a fstype is defined and the volume's access mode
351
+ // contains ReadWriteOnce, then the defined fsGroup will be applied.
352
+ // This mode should be defined if it's expected that the
353
+ // fsGroup may need to be modified depending on the pod's SecurityPolicy.
354
+ // This is the default behavior if no other FSGroupPolicy is defined.
355
+ ReadWriteOnceWithFSTypeFSGroupPolicy FSGroupPolicy = "ReadWriteOnceWithFSType"
356
+
357
+ // FileFSGroupPolicy indicates that CSI driver supports volume ownership
358
+ // and permission change via fsGroup, and Kubernetes may use fsGroup
359
+ // to change permissions and ownership of the volume to match user requested fsGroup in
360
+ // the pod's SecurityPolicy regardless of fstype or access mode.
361
+ // This mode should be defined if the fsGroup is expected to always change on mount
362
+ FileFSGroupPolicy FSGroupPolicy = "File"
363
+
364
+ // NoneFSGroupPolicy indicates that volumes will be mounted without performing
365
+ // any ownership or permission modifications, as the CSIDriver does not support
366
+ // these operations.
367
+ // This mode should be selected if the CSIDriver does not support fsGroup modifications,
368
+ // for example when Kubernetes cannot change ownership and permissions on a volume due
369
+ // to root-squash settings on a NFS volume.
370
+ NoneFSGroupPolicy FSGroupPolicy = "None"
371
+ )
372
+
334
373
// VolumeLifecycleMode specifies how a CSI volume is used in Kubernetes.
335
374
// More modes may be added in the future.
336
375
type VolumeLifecycleMode string
0 commit comments