Skip to content

Commit

Permalink
only set spec.volumes readonly if PVC is readonly for datamover
Browse files Browse the repository at this point in the history
  • Loading branch information
sseago committed Oct 9, 2024
1 parent ba0dbb9 commit 92a8000
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/exposer/csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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

Expand All @@ -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 {
Expand Down

0 comments on commit 92a8000

Please sign in to comment.