diff --git a/pkg/manila/volumes.go b/pkg/manila/volumes.go index 24ad4543..f064def2 100644 --- a/pkg/manila/volumes.go +++ b/pkg/manila/volumes.go @@ -48,12 +48,6 @@ func GetVolumes(name string, extraVol []manilav1.ManilaExtraVolMounts, svc []sto }, }, }, - /*{ - Name: "config-data-merged", - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{Medium: ""}, - }, - },*/ } for _, exv := range extraVol { diff --git a/pkg/manilashare/statefulset.go b/pkg/manilashare/statefulset.go index 5c68fc06..bb3474e1 100644 --- a/pkg/manilashare/statefulset.go +++ b/pkg/manilashare/statefulset.go @@ -81,11 +81,13 @@ func StatefulSet( volumes := GetVolumes( manila.GetOwningManilaName(instance), instance.Name, - instance.Spec.ExtraMounts) + instance.Spec.ExtraMounts, + instance.ShareName(), + ) volumeMounts := GetVolumeMounts( - instance.Name, instance.Spec.ExtraMounts, + instance.ShareName(), ) // Add the CA bundle diff --git a/pkg/manilashare/volumes.go b/pkg/manilashare/volumes.go index 0fc264be..fbefd07e 100644 --- a/pkg/manilashare/volumes.go +++ b/pkg/manilashare/volumes.go @@ -5,11 +5,15 @@ import ( manilav1 "github.com/openstack-k8s-operators/manila-operator/api/v1beta1" "github.com/openstack-k8s-operators/manila-operator/pkg/manila" corev1 "k8s.io/api/core/v1" - "strings" ) // GetVolumes - -func GetVolumes(parentName string, name string, extraVol []manilav1.ManilaExtraVolMounts) []corev1.Volume { +func GetVolumes( + parentName string, + name string, + extraVol []manilav1.ManilaExtraVolMounts, + propagationInstanceName string, +) []corev1.Volume { var config0644AccessMode int32 = 0644 var dirOrCreate = corev1.HostPathDirectoryOrCreate @@ -35,12 +39,15 @@ func GetVolumes(parentName string, name string, extraVol []manilav1.ManilaExtraV } // Set the propagation levels for ManilaShare, including the backend name - propagation := append(manila.ManilaSharePropagation, storage.PropagationType(strings.TrimPrefix(name, "manila-share-"))) + propagation := append(manila.ManilaSharePropagation, storage.PropagationType(propagationInstanceName)) return append(manila.GetVolumes(parentName, extraVol, propagation), shareVolumes...) } // GetVolumeMounts - Manila Share VolumeMounts -func GetVolumeMounts(name string, extraVol []manilav1.ManilaExtraVolMounts) []corev1.VolumeMount { +func GetVolumeMounts( + extraVol []manilav1.ManilaExtraVolMounts, + propagationInstanceName string, +) []corev1.VolumeMount { shareVolumeMounts := []corev1.VolumeMount{ { Name: "config-data-custom", @@ -59,6 +66,6 @@ func GetVolumeMounts(name string, extraVol []manilav1.ManilaExtraVolMounts) []co } // Set the propagation levels for ManilaShare, including the backend name - propagation := append(manila.ManilaSharePropagation, storage.PropagationType(strings.TrimPrefix(name, "manila-share-"))) + propagation := append(manila.ManilaSharePropagation, storage.PropagationType(propagationInstanceName)) return append(manila.GetVolumeMounts(extraVol, propagation), shareVolumeMounts...) }