Skip to content

Commit 9012c1a

Browse files
committed
Rabbitmq vhost and user support
Add support for a dedicated rabbitmq cluster for notifications. Add new messagingBus and notificationsBus interfaces to hold cluster, user and vhost names for optional usage. The controller adds these values to the TransportURL create request when present. Additionally, we migrate RabbitMQ cluster name to RabbitMq config struct using DefaultRabbitMqConfig from infra-operator to automatically populate the new Cluster field from legacy RabbitMqClusterName. Example usage: spec: messagingBus: cluster: rpc-rabbitmq user: rpc-user vhost: rpc-vhost notificationsBus: cluster: notifications-rabbitmq user: notifications-user vhost: notifications-vhost Jira: https://issues.redhat.com/browse/OSPRH-23909
1 parent 3341e0a commit 9012c1a

34 files changed

Lines changed: 1437 additions & 92 deletions

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ tidy: ## Run go mod tidy on every mod file in the repo
116116

117117
.PHONY: test
118118
test: manifests generate fmt vet envtest ## Run tests.
119-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
119+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... ./api/... -coverprofile cover.out
120120

121121
##@ Build
122122

‎api/bases/telemetry.openstack.org_autoscalings.yaml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,23 @@ spec:
122122
description: NodeSelector to target subset of worker nodes running
123123
this service
124124
type: object
125+
notificationsBus:
126+
description: NotificationsBus configuration (username, vhost,
127+
and cluster) for notifications
128+
properties:
129+
cluster:
130+
description: Name of the cluster
131+
minLength: 1
132+
type: string
133+
user:
134+
description: User - RabbitMQ username
135+
type: string
136+
vhost:
137+
description: Vhost - RabbitMQ vhost name
138+
type: string
139+
required:
140+
- cluster
141+
type: object
125142
notifierImage:
126143
type: string
127144
override:
@@ -315,6 +332,7 @@ spec:
315332
description: |-
316333
RabbitMQ instance name
317334
Needed to request a transportURL that is created and used in Aodh
335+
Deprecated: Use NotificationsBus.Cluster instead
318336
type: string
319337
secret:
320338
default: osp-secret
@@ -502,6 +520,10 @@ spec:
502520
items:
503521
type: string
504522
type: array
523+
notificationsURLSecret:
524+
description: NotificationsURLSecret - Secret containing RabbitMQ notification
525+
transportURL
526+
type: string
505527
observedGeneration:
506528
description: |-
507529
ObservedGeneration - the most recent generation observed for this

‎api/bases/telemetry.openstack.org_ceilometers.yaml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,23 @@ spec:
199199
type: object
200200
notificationImage:
201201
type: string
202+
notificationsBus:
203+
description: NotificationsBus configuration (username, vhost, and
204+
cluster) for notifications
205+
properties:
206+
cluster:
207+
description: Name of the cluster
208+
minLength: 1
209+
type: string
210+
user:
211+
description: User - RabbitMQ username
212+
type: string
213+
vhost:
214+
description: Vhost - RabbitMQ vhost name
215+
type: string
216+
required:
217+
- cluster
218+
type: object
202219
passwordSelector:
203220
default:
204221
ceilometerService: CeilometerPassword
@@ -228,6 +245,7 @@ spec:
228245
description: |-
229246
RabbitMQ instance name
230247
Needed to request a transportURL that is created and used in Telemetry
248+
Deprecated: Use NotificationsBus.Cluster instead
231249
type: string
232250
secret:
233251
default: osp-secret
@@ -373,6 +391,10 @@ spec:
373391
items:
374392
type: string
375393
type: array
394+
notificationsURLSecret:
395+
description: NotificationsURLSecret - Secret containing RabbitMQ notification
396+
transportURL
397+
type: string
376398
observedGeneration:
377399
description: |-
378400
ObservedGeneration - the most recent generation observed for this

‎api/bases/telemetry.openstack.org_cloudkitties.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,22 @@ spec:
544544
default: memcached
545545
description: Memcached instance name.
546546
type: string
547+
messagingBus:
548+
description: MessagingBus configuration (username, vhost, and cluster)
549+
properties:
550+
cluster:
551+
description: Name of the cluster
552+
minLength: 1
553+
type: string
554+
user:
555+
description: User - RabbitMQ username
556+
type: string
557+
vhost:
558+
description: Vhost - RabbitMQ vhost name
559+
type: string
560+
required:
561+
- cluster
562+
type: object
547563
nodeSelector:
548564
additionalProperties:
549565
type: string
@@ -623,6 +639,7 @@ spec:
623639
description: |-
624640
RabbitMQ instance name
625641
Needed to request a transportURL that is created and used in CloudKitty
642+
Deprecated: Use MessagingBus.Cluster instead
626643
type: string
627644
s3StorageConfig:
628645
default:

‎api/bases/telemetry.openstack.org_telemetries.yaml‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,23 @@ spec:
125125
description: NodeSelector to target subset of worker nodes
126126
running this service
127127
type: object
128+
notificationsBus:
129+
description: NotificationsBus configuration (username, vhost,
130+
and cluster) for notifications
131+
properties:
132+
cluster:
133+
description: Name of the cluster
134+
minLength: 1
135+
type: string
136+
user:
137+
description: User - RabbitMQ username
138+
type: string
139+
vhost:
140+
description: Vhost - RabbitMQ vhost name
141+
type: string
142+
required:
143+
- cluster
144+
type: object
128145
notifierImage:
129146
type: string
130147
override:
@@ -318,6 +335,7 @@ spec:
318335
description: |-
319336
RabbitMQ instance name
320337
Needed to request a transportURL that is created and used in Aodh
338+
Deprecated: Use NotificationsBus.Cluster instead
321339
type: string
322340
secret:
323341
default: osp-secret
@@ -527,6 +545,23 @@ spec:
527545
type: object
528546
notificationImage:
529547
type: string
548+
notificationsBus:
549+
description: NotificationsBus configuration (username, vhost,
550+
and cluster) for notifications
551+
properties:
552+
cluster:
553+
description: Name of the cluster
554+
minLength: 1
555+
type: string
556+
user:
557+
description: User - RabbitMQ username
558+
type: string
559+
vhost:
560+
description: Vhost - RabbitMQ vhost name
561+
type: string
562+
required:
563+
- cluster
564+
type: object
530565
passwordSelector:
531566
default:
532567
ceilometerService: CeilometerPassword
@@ -556,6 +591,7 @@ spec:
556591
description: |-
557592
RabbitMQ instance name
558593
Needed to request a transportURL that is created and used in Telemetry
594+
Deprecated: Use NotificationsBus.Cluster instead
559595
type: string
560596
secret:
561597
default: osp-secret
@@ -1112,6 +1148,23 @@ spec:
11121148
default: memcached
11131149
description: Memcached instance name.
11141150
type: string
1151+
messagingBus:
1152+
description: MessagingBus configuration (username, vhost, and
1153+
cluster)
1154+
properties:
1155+
cluster:
1156+
description: Name of the cluster
1157+
minLength: 1
1158+
type: string
1159+
user:
1160+
description: User - RabbitMQ username
1161+
type: string
1162+
vhost:
1163+
description: Vhost - RabbitMQ vhost name
1164+
type: string
1165+
required:
1166+
- cluster
1167+
type: object
11151168
nodeSelector:
11161169
additionalProperties:
11171170
type: string
@@ -1192,6 +1245,7 @@ spec:
11921245
description: |-
11931246
RabbitMQ instance name
11941247
Needed to request a transportURL that is created and used in CloudKitty
1248+
Deprecated: Use MessagingBus.Cluster instead
11951249
type: string
11961250
s3StorageConfig:
11971251
default:

‎api/go.mod‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module github.com/openstack-k8s-operators/telemetry-operator/api
33
go 1.24.4
44

55
require (
6-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260108154501-11e5091cddf1
6+
github.com/onsi/gomega v1.39.0
7+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260122115041-7971a43cbfa0
78
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35
89
github.com/rhobs/observability-operator v0.3.1
910
k8s.io/api v0.31.14
@@ -16,7 +17,6 @@ require (
1617
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1718
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1819
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
19-
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2020
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2121
github.com/fsnotify/fsnotify v1.9.0 // indirect
2222
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -38,11 +38,13 @@ require (
3838
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3939
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4040
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
41+
github.com/onsi/ginkgo/v2 v2.27.4 // indirect
4142
github.com/pkg/errors v0.9.1 // indirect
4243
github.com/prometheus/client_golang v1.22.0 // indirect
4344
github.com/prometheus/client_model v0.6.2 // indirect
4445
github.com/prometheus/common v0.65.0 // indirect
4546
github.com/prometheus/procfs v0.16.1 // indirect
47+
github.com/rabbitmq/cluster-operator/v2 v2.16.0 // indirect
4648
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.71.0-rhobs1 // indirect
4749
github.com/spf13/pflag v1.0.7 // indirect
4850
github.com/x448/float16 v0.8.4 // indirect

‎api/go.sum‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
12
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
23
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
34
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -74,14 +75,14 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd
7475
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
7576
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
7677
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
77-
github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8=
78-
github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
79-
github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
80-
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
81-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260108154501-11e5091cddf1 h1:zAbZVtpldi1TU/CO9aU2ZByzcsi+N3aIv6snpSjBVLY=
82-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260108154501-11e5091cddf1/go.mod h1:ZXwFlspJCdZEUjMbmaf61t5AMB4u2vMyAMMoe/vJroE=
78+
github.com/onsi/ginkgo/v2 v2.27.4 h1:fcEcQW/A++6aZAZQNUmNjvA9PSOzefMJBerHJ4t8v8Y=
79+
github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q=
80+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260122115041-7971a43cbfa0 h1:Dqpqvm+2w62QVdI2yHsn2h0cDRGo9wCjSuaLq3H+9XU=
81+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260122115041-7971a43cbfa0/go.mod h1:ZXwFlspJCdZEUjMbmaf61t5AMB4u2vMyAMMoe/vJroE=
8382
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35 h1:pF3mJ3nwq6r4qwom+rEWZNquZpcQW/iftHlJ1KPIDsk=
8483
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35/go.mod h1:kycZyoe7OZdW1HUghr2nI3N7wSJtNahXf6b/ypD14f4=
84+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
85+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
8586
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8687
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8788
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

‎api/v1beta1/autoscaling_types.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
2021
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2122
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2223
"github.com/openstack-k8s-operators/lib-common/modules/common/tls"
@@ -63,8 +64,13 @@ type AodhCore struct {
6364
// APITimeout for Route and Apache
6465
APITimeout int `json:"apiTimeout"`
6566

67+
// +kubebuilder:validation:Optional
68+
// NotificationsBus configuration (username, vhost, and cluster) for notifications
69+
NotificationsBus *rabbitmqv1.RabbitMqConfig `json:"notificationsBus,omitempty"`
70+
6671
// RabbitMQ instance name
6772
// Needed to request a transportURL that is created and used in Aodh
73+
// Deprecated: Use NotificationsBus.Cluster instead
6874
// +kubebuilder:default=rabbitmq
6975
RabbitMqClusterName string `json:"rabbitMqClusterName,omitempty"`
7076

@@ -201,6 +207,9 @@ type AutoscalingStatus struct {
201207
// TransportURLSecret - Secret containing RabbitMQ transportURL
202208
TransportURLSecret string `json:"transportURLSecret,omitempty"`
203209

210+
// NotificationsURLSecret - Secret containing RabbitMQ notification transportURL
211+
NotificationsURLSecret *string `json:"notificationsURLSecret,omitempty"`
212+
204213
// DatabaseHostname - Hostname for the database
205214
DatabaseHostname string `json:"databaseHostname,omitempty"`
206215

0 commit comments

Comments
 (0)