Skip to content

Commit

Permalink
Merge pull request #358 from fmount/extram-inst
Browse files Browse the repository at this point in the history
Do not use strings.TrimPrefix to get ShareName
  • Loading branch information
openshift-merge-bot[bot] authored Nov 6, 2024
2 parents 76179db + 4bca5d7 commit 61488e9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 0 additions & 6 deletions pkg/manila/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions pkg/manilashare/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions pkg/manilashare/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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",
Expand All @@ -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...)
}

0 comments on commit 61488e9

Please sign in to comment.