Skip to content

Commit 42136c3

Browse files
Merge pull request #1662 from openstack-k8s-operators/revert-1611-quorum2
Revert "Switch to quorumqueues only for new controlplane resources"
2 parents eaea098 + 8ea6bf0 commit 42136c3

File tree

2 files changed

+0
-64
lines changed

2 files changed

+0
-64
lines changed

apis/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,22 +1068,6 @@ func (r *OpenStackControlPlane) DefaultServices() {
10681068
r.Spec.Designate.Template.Default()
10691069
}
10701070

1071-
// RabbitMQ
1072-
if r.Spec.Rabbitmq.Enabled || r.Spec.Rabbitmq.Templates != nil {
1073-
if r.Spec.Rabbitmq.Templates == nil {
1074-
r.Spec.Rabbitmq.Templates = ptr.To(map[string]rabbitmqv1.RabbitMqSpecCore{})
1075-
}
1076-
1077-
for key, template := range *r.Spec.Rabbitmq.Templates {
1078-
// Enforce queueType=Quorum for all new resources, preserve existing resources unchanged
1079-
if r.ObjectMeta.CreationTimestamp.IsZero() {
1080-
template.QueueType = "Quorum"
1081-
}
1082-
// By-value copy, need to update
1083-
(*r.Spec.Rabbitmq.Templates)[key] = template
1084-
}
1085-
}
1086-
10871071
// Redis
10881072
if r.Spec.Redis.Enabled || r.Spec.Redis.Templates != nil {
10891073
if r.Spec.Redis.Templates == nil {

tests/functional/ctlplane/openstackoperator_controller_test.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,54 +3145,6 @@ var _ = Describe("OpenStackOperator Webhook", func() {
31453145
Expect(OSCtlplane.Labels).Should(HaveKeyWithValue("core.openstack.org/openstackcontrolplane", "foo"))
31463146
})
31473147

3148-
It("Enforces queueType=Quorum for new resources", func() {
3149-
spec := GetDefaultOpenStackControlPlaneSpec()
3150-
spec["tls"] = GetTLSPublicSpec()
3151-
3152-
DeferCleanup(
3153-
th.DeleteInstance,
3154-
CreateOpenStackControlPlane(types.NamespacedName{Name: "test-new-quorum", Namespace: namespace}, spec),
3155-
)
3156-
3157-
OSCtlplane := GetOpenStackControlPlane(types.NamespacedName{Name: "test-new-quorum", Namespace: namespace})
3158-
Expect(OSCtlplane.Spec.Rabbitmq.Templates).Should(Not(BeNil()))
3159-
3160-
// Verify that all templates get queueType=Quorum for new resources
3161-
for templateName, template := range *OSCtlplane.Spec.Rabbitmq.Templates {
3162-
Expect(template.QueueType).Should(Equal("Quorum"), "RabbitMQ template %s should have queueType=Quorum", templateName)
3163-
}
3164-
})
3165-
3166-
It("Preserves existing queueType values on updates", func() {
3167-
spec := GetDefaultOpenStackControlPlaneSpec()
3168-
spec["tls"] = GetTLSPublicSpec()
3169-
3170-
// Create a resource first (will get Quorum by default)
3171-
ctlplane := CreateOpenStackControlPlane(types.NamespacedName{Name: "test-preserve-existing", Namespace: namespace}, spec)
3172-
DeferCleanup(th.DeleteInstance, ctlplane)
3173-
3174-
// Manually set it to Mirrored to simulate existing deployment
3175-
Eventually(func(g Gomega) {
3176-
existingCtlplane := GetOpenStackControlPlane(types.NamespacedName{Name: "test-preserve-existing", Namespace: namespace})
3177-
(*existingCtlplane.Spec.Rabbitmq.Templates)["rabbitmq"] = rabbitmqv1.RabbitMqSpecCore{
3178-
QueueType: "Mirrored", // Simulate existing value
3179-
}
3180-
g.Expect(k8sClient.Update(ctx, existingCtlplane)).Should(Succeed())
3181-
}).Should(Succeed())
3182-
3183-
// Verify it's preserved on subsequent updates
3184-
Eventually(func(g Gomega) {
3185-
updatedCtlplane := GetOpenStackControlPlane(types.NamespacedName{Name: "test-preserve-existing", Namespace: namespace})
3186-
updatedCtlplane.Spec.Secret = "updated-secret" // Trigger webhook
3187-
g.Expect(k8sClient.Update(ctx, updatedCtlplane)).Should(Succeed())
3188-
3189-
// Should still be Mirrored after update
3190-
finalCtlplane := GetOpenStackControlPlane(types.NamespacedName{Name: "test-preserve-existing", Namespace: namespace})
3191-
rabbitTemplate := (*finalCtlplane.Spec.Rabbitmq.Templates)["rabbitmq"]
3192-
g.Expect(rabbitTemplate.QueueType).Should(Equal("Mirrored"), "Existing queueType should be preserved")
3193-
}).Should(Succeed())
3194-
})
3195-
31963148
It("calls placement validation webhook", func() {
31973149
spec := GetDefaultOpenStackControlPlaneSpec()
31983150
spec["tls"] = GetTLSPublicSpec()

0 commit comments

Comments
 (0)