From 92a8000f5598294dd6e07fe847d7a3db4aea3d61 Mon Sep 17 00:00:00 2001 From: Scott Seago Date: Wed, 9 Oct 2024 12:24:08 -0400 Subject: [PATCH] only set spec.volumes readonly if PVC is readonly for datamover --- pkg/exposer/csi_snapshot.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 {