diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index 908c2d9c68a..373677ae297 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -202,6 +202,7 @@ func (e *csiSnapshotExposer) Expose(ctx context.Context, ownerObject corev1.Obje csiExposeParam.HostingPodLabels, csiExposeParam.Affinity, csiExposeParam.Resources, + backupPVCReadOnly, ) if err != nil { return errors.Wrap(err, "error to create backup pod") @@ -442,6 +443,7 @@ func (e *csiSnapshotExposer) createBackupPod( label map[string]string, affinity *kube.LoadAffinity, resources corev1.ResourceRequirements, + backupPVCReadOnly bool, ) (*corev1.Pod, error) { podName := ownerObject.Name @@ -462,10 +464,14 @@ func (e *csiSnapshotExposer) createBackupPod( VolumeSource: corev1.VolumeSource{ PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{ ClaimName: backupPVC.Name, - ReadOnly: true, }, }, }} + + if backupPVCReadOnly { + volumes[0].VolumeSource.PersistentVolumeClaim.ReadOnly = true + } + volumes = append(volumes, podInfo.volumes...) if label == nil {