From e89d57e1daaa23b09325c54480c23115eeabd574 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 15 Oct 2024 20:57:35 -0400 Subject: [PATCH] Add ConvertVolumeSource function to storage module Converts from VolumeSource to a corev1.VolumeSource --- modules/storage/storage.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index fd175503..e5ae8ba7 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -151,3 +151,25 @@ func (v *VolMounts) Propagate(svc []PropagationType) []VolMounts { return vl } + +// ConvertVolumeSource function to convert from a VolumeSource to a corev1.VolumeSource +func ConvertVolumeSource(v *VolumeSource) corev1.VolumeSource { + return corev1.VolumeSource{ + HostPath: v.HostPath, + EmptyDir: v.EmptyDir, + Secret: v.Secret, + NFS: v.NFS, + ISCSI: v.ISCSI, + PersistentVolumeClaim: v.PersistentVolumeClaim, + CephFS: v.CephFS, + DownwardAPI: v.DownwardAPI, + FC: v.FC, + ConfigMap: v.ConfigMap, + PhotonPersistentDisk: v.PhotonPersistentDisk, + Projected: v.Projected, + ScaleIO: v.ScaleIO, + StorageOS: v.StorageOS, + CSI: v.CSI, + Ephemeral: v.Ephemeral, + } +}