- Introduce new flag to enable feature to prevent unauthorised volume mode conversion

- Changes to snapshot controller to read the volume mode from the PV and add it to SourceVolumeMode field in VolumeSnapshotContent
This commit is contained in:
Raunak Pradip Shah
2022-03-30 10:20:55 +05:30
parent 019a59a10f
commit 5b578e8573
4 changed files with 21 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ type csiSnapshotCommonController struct {
resyncPeriod time.Duration
enableDistributedSnapshotting bool
preventVolumeModeConversion bool
}
// NewCSISnapshotController returns a new *csiSnapshotCommonController
@@ -84,6 +85,7 @@ func NewCSISnapshotCommonController(
snapshotRateLimiter workqueue.RateLimiter,
contentRateLimiter workqueue.RateLimiter,
enableDistributedSnapshotting bool,
preventVolumeModeConversion bool,
) *csiSnapshotCommonController {
broadcaster := record.NewBroadcaster()
broadcaster.StartLogging(klog.Infof)
@@ -138,6 +140,8 @@ func NewCSISnapshotCommonController(
ctrl.nodeListerSynced = nodeInformer.Informer().HasSynced
}
ctrl.preventVolumeModeConversion = preventVolumeModeConversion
return ctrl
}