Skip to content

Commit

Permalink
Concatenate global and service specific extraMounts
Browse files Browse the repository at this point in the history
The list of global and service specific extraMounts are now
concatenated, instead of the previous behavior where service
specific extraMounts would supersede/override the global list.

The services that support their own list of extraMounts is
unchanged. Those services are cinder, glance, manila and neutron.
  • Loading branch information
ASBishop committed Mar 11, 2024
1 parent 81a98c7 commit 169dda1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
7 changes: 3 additions & 4 deletions pkg/openstack/cinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl
//cinder.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here
cinder.Spec.DatabaseInstance = "openstack" //FIXME: see above
}
// if already defined at service level (template section), we don't merge
// with the global defined extra volumes
if len(cinder.Spec.ExtraMounts) == 0 {
// Append globally defined extraMounts to the service's own list.
if len(instance.Spec.ExtraMounts) > 0 {

var cinderVolumes []cinderv1.CinderExtraVolMounts

Expand All @@ -124,7 +123,7 @@ func ReconcileCinder(ctx context.Context, instance *corev1beta1.OpenStackControl
VolMounts: ev.VolMounts,
})
}
cinder.Spec.ExtraMounts = cinderVolumes
cinder.Spec.ExtraMounts = append(cinder.Spec.ExtraMounts, cinderVolumes...)
}
err := controllerutil.SetControllerReference(helper.GetBeforeObject(), cinder, helper.GetScheme())
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/openstack/glance.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,8 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
if glance.Spec.StorageClass == "" {
glance.Spec.StorageClass = instance.Spec.StorageClass
}
// if already defined at service level (template section), we don't merge
// with the global defined extra volumes
if len(glance.Spec.ExtraMounts) == 0 {
// Append globally defined extraMounts to the service's own list.
if len(instance.Spec.ExtraMounts) > 0 {

var glanceVolumes []glancev1.GlanceExtraVolMounts

Expand All @@ -163,7 +162,7 @@ func ReconcileGlance(ctx context.Context, instance *corev1beta1.OpenStackControl
VolMounts: ev.VolMounts,
})
}
glance.Spec.ExtraMounts = glanceVolumes
glance.Spec.ExtraMounts = append(glance.Spec.ExtraMounts, glanceVolumes...)
}

err := controllerutil.SetControllerReference(helper.GetBeforeObject(), glance, helper.GetScheme())
Expand Down
7 changes: 3 additions & 4 deletions pkg/openstack/manila.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl
//manila.Spec.DatabaseInstance = instance.Name // name of MariaDB we create here
manila.Spec.DatabaseInstance = "openstack" //FIXME: see above
}
// if already defined at service level (template section), we don't merge
// with the global defined extra volumes
if len(manila.Spec.ExtraMounts) == 0 {
// Append globally defined extraMounts to the service's own list.
if len(instance.Spec.ExtraMounts) > 0 {

var manilaVolumes []manilav1.ManilaExtraVolMounts

Expand All @@ -125,7 +124,7 @@ func ReconcileManila(ctx context.Context, instance *corev1beta1.OpenStackControl
VolMounts: ev.VolMounts,
})
}
manila.Spec.ExtraMounts = manilaVolumes
manila.Spec.ExtraMounts = append(manila.Spec.ExtraMounts, manilaVolumes...)
}
err := controllerutil.SetControllerReference(helper.GetBeforeObject(), manila, helper.GetScheme())
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/openstack/neutron.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro
neutronAPI.Spec.DatabaseInstance = "openstack"
}

// if already defined at service level (template section), we don't merge
// with the global defined extra volumes
if len(neutronAPI.Spec.ExtraMounts) == 0 {
// Append globally defined extraMounts to the service's own list.
if len(instance.Spec.ExtraMounts) > 0 {

var neutronVolumes []neutronv1.NeutronExtraVolMounts

Expand All @@ -156,7 +155,7 @@ func ReconcileNeutron(ctx context.Context, instance *corev1beta1.OpenStackContro
VolMounts: ev.VolMounts,
})
}
neutronAPI.Spec.ExtraMounts = neutronVolumes
neutronAPI.Spec.ExtraMounts = append(neutronAPI.Spec.ExtraMounts, neutronVolumes...)
}
err := controllerutil.SetControllerReference(helper.GetBeforeObject(), neutronAPI, helper.GetScheme())
if err != nil {
Expand Down

0 comments on commit 169dda1

Please sign in to comment.