Skip to content

Commit a95d6d0

Browse files
Merge pull request #367 from lmiccini/quorum2
Use quorum queues if enabled
2 parents f249c61 + 0cc2090 commit a95d6d0

File tree

7 files changed

+99
-6
lines changed

7 files changed

+99
-6
lines changed

api/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414

1515
require (
1616
github.com/onsi/gomega v1.34.1
17-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec
17+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f
1818
)
1919

2020
require (

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo
7272
github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
7373
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
7474
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
75-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec h1:Jvz2BuTWCvjeCbDzpPzlPMrUQpEe04Rzi8LPNxeW0Ts=
76-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec/go.mod h1:Dv8qpmBIQy3Jv/EyQnOyc0w61X8vyfxpjcIQONP5CwY=
75+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f h1:chuu4iBT5sXHYw8aPeP/pWC+S3yGo6hdy39foP7c5vs=
76+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f/go.mod h1:Dv8qpmBIQy3Jv/EyQnOyc0w61X8vyfxpjcIQONP5CwY=
7777
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250823121217-7e1cd2e3dd03 h1:9VanDdvg1APf9B1nzGElLvWr6dM5GsSayMLSV/nJZnE=
7878
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250823121217-7e1cd2e3dd03/go.mod h1:Z+rmtn3qhuPZfx2EDVmloUh2MkYbvDMgcpJneRYerS0=
7979
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20250823121217-7e1cd2e3dd03 h1:DrKbzsweRx8VBNb5ur+/XcHSi+MR3VdzCsIEXYGc5SM=

controllers/designate_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,7 @@ func (r *DesignateReconciler) generateServiceConfigMaps(
14091409
return err
14101410
}
14111411
templateParameters["TransportURL"] = string(transportURLSecret.Data["transport_url"])
1412+
templateParameters["QuorumQueues"] = string(transportURLSecret.Data["quorumqueues"]) == "true"
14121413

14131414
adminPasswordSecret, _, err := oko_secret.GetSecret(ctx, h, instance.Spec.Secret, instance.Namespace)
14141415
if err != nil {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/onsi/ginkgo/v2 v2.20.1
1212
github.com/onsi/gomega v1.34.1
1313
github.com/openstack-k8s-operators/designate-operator/api v0.1.1-0.20240807132522-6c2eca7c6bbb
14-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec
14+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f
1515
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250823150446-aa5dac847cf1
1616
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250823121217-7e1cd2e3dd03
1717
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20250823121217-7e1cd2e3dd03

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
9090
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
9191
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094 h1:J1wuGhVxpsHykZBa6Beb1gQ96Ptej9AE/BvwCBiRj1E=
9292
github.com/openshift/api v0.0.0-20240830023148-b7d0481c9094/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
93-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec h1:Jvz2BuTWCvjeCbDzpPzlPMrUQpEe04Rzi8LPNxeW0Ts=
94-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250821143610-c8ef7b9a21ec/go.mod h1:Dv8qpmBIQy3Jv/EyQnOyc0w61X8vyfxpjcIQONP5CwY=
93+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f h1:chuu4iBT5sXHYw8aPeP/pWC+S3yGo6hdy39foP7c5vs=
94+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250909143828-e33d35ffd64f/go.mod h1:Dv8qpmBIQy3Jv/EyQnOyc0w61X8vyfxpjcIQONP5CwY=
9595
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250823150446-aa5dac847cf1 h1:LM953646RkmGf3mLAyNk+zmcFNnFpMLDCkjSdvossSE=
9696
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20250823150446-aa5dac847cf1/go.mod h1:G6BkoPfgALryMlOZwIH036iSWUMiDJQAYL1lXuLyPZ0=
9797
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250823121217-7e1cd2e3dd03 h1:9VanDdvg1APf9B1nzGElLvWr6dM5GsSayMLSV/nJZnE=

templates/designate/config/designate.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ connection={{ .DatabaseConnection }}
1818
[oslo_messaging_notifications]
1919
topics=notifications
2020
driver=messagingv2
21+
{{ if (index . "QuorumQueues") }}
22+
[oslo_messaging_rabbit]
23+
rabbit_quorum_queue=true
24+
rabbit_transient_quorum_queue=true
25+
amqp_durable_queues=true
26+
{{- end }}
2127

2228
[oslo_policy]
2329
enforce_scope=False

tests/functional/designate_controller_test.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,92 @@ var _ = Describe("Designate controller", func() {
993993
}, timeout, interval).Should(Succeed())
994994
})
995995
})
996+
997+
// Quorum Queues Tests
998+
When("Designate is created with quorum queues enabled from start", func() {
999+
BeforeEach(func() {
1000+
createAndSimulateKeystone(designateName)
1001+
createAndSimulateRedis(designateRedisName)
1002+
createAndSimulateDesignateSecrets(designateName)
1003+
DeferCleanup(k8sClient.Delete, ctx, CreateTransportURL(transportURLName))
1004+
DeferCleanup(k8sClient.Delete, ctx, infra.CreateTransportURLSecret(designateName.Namespace, transportURLSecretName.Name, true))
1005+
infra.SimulateTransportURLReady(transportURLName)
1006+
createAndSimulateDB(spec)
1007+
DeferCleanup(k8sClient.Delete, ctx, CreateNAD(types.NamespacedName{
1008+
Name: spec["designateNetworkAttachment"].(string),
1009+
Namespace: namespace,
1010+
}))
1011+
DeferCleanup(th.DeleteInstance, CreateDesignate(designateName, spec))
1012+
th.SimulateJobSuccess(designateDBSyncName)
1013+
})
1014+
1015+
It("should configure quorum queues settings in designate.conf", func() {
1016+
configData := th.GetSecret(
1017+
types.NamespacedName{
1018+
Namespace: designateName.Namespace,
1019+
Name: fmt.Sprintf("%s-config-data", designateName.Name)})
1020+
Expect(configData).ShouldNot(BeNil())
1021+
conf := string(configData.Data["designate.conf"])
1022+
1023+
Expect(conf).Should(ContainSubstring("rabbit_quorum_queue=true"))
1024+
Expect(conf).Should(ContainSubstring("rabbit_transient_quorum_queue=true"))
1025+
Expect(conf).Should(ContainSubstring("amqp_durable_queues=true"))
1026+
})
1027+
})
1028+
1029+
When("Designate starts with quorum queues disabled then enables them", func() {
1030+
BeforeEach(func() {
1031+
createAndSimulateKeystone(designateName)
1032+
createAndSimulateRedis(designateRedisName)
1033+
createAndSimulateDesignateSecrets(designateName)
1034+
DeferCleanup(k8sClient.Delete, ctx, CreateTransportURL(transportURLName))
1035+
DeferCleanup(k8sClient.Delete, ctx, infra.CreateTransportURLSecret(designateName.Namespace, transportURLSecretName.Name, false))
1036+
infra.SimulateTransportURLReady(transportURLName)
1037+
createAndSimulateDB(spec)
1038+
DeferCleanup(k8sClient.Delete, ctx, CreateNAD(types.NamespacedName{
1039+
Name: spec["designateNetworkAttachment"].(string),
1040+
Namespace: namespace,
1041+
}))
1042+
DeferCleanup(th.DeleteInstance, CreateDesignate(designateName, spec))
1043+
th.SimulateJobSuccess(designateDBSyncName)
1044+
})
1045+
1046+
It("should update config when quorum queues are enabled", func() {
1047+
// Initially, quorum queues should be disabled
1048+
configData := th.GetSecret(
1049+
types.NamespacedName{
1050+
Namespace: designateName.Namespace,
1051+
Name: fmt.Sprintf("%s-config-data", designateName.Name)})
1052+
Expect(configData).ShouldNot(BeNil())
1053+
conf := string(configData.Data["designate.conf"])
1054+
1055+
Expect(conf).ShouldNot(ContainSubstring("rabbit_quorum_queue=true"))
1056+
Expect(conf).ShouldNot(ContainSubstring("rabbit_transient_quorum_queue=true"))
1057+
Expect(conf).ShouldNot(ContainSubstring("amqp_durable_queues=true"))
1058+
1059+
// Update the secret to enable quorum queues
1060+
Eventually(func(g Gomega) {
1061+
secret := &corev1.Secret{}
1062+
g.Expect(k8sClient.Get(ctx, transportURLSecretName, secret)).Should(Succeed())
1063+
secret.Data["quorumqueues"] = []byte("true")
1064+
g.Expect(k8sClient.Update(ctx, secret)).Should(Succeed())
1065+
}, timeout, interval).Should(Succeed())
1066+
1067+
// Verify the configuration is updated with quorum queue settings
1068+
Eventually(func(g Gomega) {
1069+
configData := th.GetSecret(
1070+
types.NamespacedName{
1071+
Namespace: designateName.Namespace,
1072+
Name: fmt.Sprintf("%s-config-data", designateName.Name)})
1073+
g.Expect(configData).ShouldNot(BeNil())
1074+
conf := string(configData.Data["designate.conf"])
1075+
1076+
g.Expect(conf).Should(ContainSubstring("rabbit_quorum_queue=true"))
1077+
g.Expect(conf).Should(ContainSubstring("rabbit_transient_quorum_queue=true"))
1078+
g.Expect(conf).Should(ContainSubstring("amqp_durable_queues=true"))
1079+
}, timeout, interval).Should(Succeed())
1080+
})
1081+
})
9961082
})
9971083

9981084
var _ = Describe("Designate webhook validation", func() {

0 commit comments

Comments
 (0)