Skip to content

Commit

Permalink
Merge pull request #464 from openshift-cherrypick-robot/cherry-pick-4…
Browse files Browse the repository at this point in the history
…63-to-18.0-fr1

[18.0-fr1] Fix extraMounts propagation when uniquePodNames is used
  • Loading branch information
openshift-merge-bot[bot] authored Nov 5, 2024
2 parents 405a20c + 5134572 commit ff3f0d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 8 additions & 2 deletions pkg/cindervolume/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ func StatefulSet(
volumes := GetVolumes(
cinder.GetOwningCinderName(instance),
instance.Name,
instance.Spec.ExtraMounts)
volumeMounts := GetVolumeMounts(instance.Name, instance.Spec.ExtraMounts, usesLVM)
instance.Spec.ExtraMounts,
instance.BackendName(),
)
volumeMounts := GetVolumeMounts(
instance.Spec.ExtraMounts,
usesLVM,
instance.BackendName(),
)

// Add the CA bundle
if instance.Spec.TLS.CaBundleSecretName != "" {
Expand Down
9 changes: 4 additions & 5 deletions pkg/cindervolume/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package cindervolume

import (
"github.com/openstack-k8s-operators/lib-common/modules/storage"
"strings"

cinderv1beta1 "github.com/openstack-k8s-operators/cinder-operator/api/v1beta1"
"github.com/openstack-k8s-operators/cinder-operator/pkg/cinder"
corev1 "k8s.io/api/core/v1"
)

// GetVolumes -
func GetVolumes(parentName string, name string, extraVol []cinderv1beta1.CinderExtraVolMounts) []corev1.Volume {
func GetVolumes(parentName string, name string, extraVol []cinderv1beta1.CinderExtraVolMounts, propagationInstanceName string) []corev1.Volume {
var config0644AccessMode int32 = 0644

volumes := []corev1.Volume{
Expand All @@ -26,12 +25,12 @@ func GetVolumes(parentName string, name string, extraVol []cinderv1beta1.CinderE
}

// Set the propagation levels for CinderVolume, including the backend name
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(strings.TrimPrefix(name, "cinder-volume-")))
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(propagationInstanceName))
return append(cinder.GetVolumes(parentName, true, extraVol, propagation), volumes...)
}

// GetVolumeMounts - Cinder Volume VolumeMounts
func GetVolumeMounts(name string, extraVol []cinderv1beta1.CinderExtraVolMounts, usesLVM bool) []corev1.VolumeMount {
func GetVolumeMounts(extraVol []cinderv1beta1.CinderExtraVolMounts, usesLVM bool, propagationInstanceName string) []corev1.VolumeMount {
var configData string
if usesLVM {
configData = "cinder-volume-lvm-config.json"
Expand All @@ -53,6 +52,6 @@ func GetVolumeMounts(name string, extraVol []cinderv1beta1.CinderExtraVolMounts,
}

// Set the propagation levels for CinderVolume, including the backend name
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(strings.TrimPrefix(name, "cinder-volume-")))
propagation := append(cinder.CinderVolumePropagation, storage.PropagationType(propagationInstanceName))
return append(cinder.GetVolumeMounts(true, extraVol, propagation), volumeVolumeMounts...)
}

0 comments on commit ff3f0d4

Please sign in to comment.