Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#363 from rabi/defaulting
Browse files Browse the repository at this point in the history
Move storageclass defaulting to webhook
  • Loading branch information
openshift-merge-robot authored Jun 26, 2023
2 parents 00e119a + 6d5ea30 commit 8b9684b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions apis/core/v1beta1/openstackcontrolplane_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ func (r *OpenStackControlPlane) DefaultServices() {

// Swift
if r.Spec.Swift.Enabled {
if r.Spec.Swift.Template.SwiftStorage.StorageClass == "" {
r.Spec.Swift.Template.SwiftStorage.StorageClass = r.Spec.StorageClass
}

r.Spec.Swift.Template.Default()
}
}
3 changes: 0 additions & 3 deletions pkg/openstack/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ func ReconcileSwift(ctx context.Context, instance *corev1beta1.OpenStackControlP
helper.GetLogger().Info("Reconciling Swift", "Swift.Namespace", instance.Namespace, "Swift.Name", "swift")
op, err := controllerutil.CreateOrPatch(ctx, helper.GetClient(), swift, func() error {
instance.Spec.Swift.Template.DeepCopyInto(&swift.Spec)
if swift.Spec.SwiftStorage.StorageClass == "" {
swift.Spec.SwiftStorage.StorageClass = instance.Spec.StorageClass
}
err := controllerutil.SetControllerReference(helper.GetBeforeObject(), swift, helper.GetScheme())
if err != nil {
return err
Expand Down

0 comments on commit 8b9684b

Please sign in to comment.