Skip to content

Commit fe7d760

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 fe7d760

28 files changed

Lines changed: 1085 additions & 37 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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,23 @@ spec:
110110
default: memcached
111111
description: Memcached instance name.
112112
type: string
113+
messagingBus:
114+
description: MessagingBus configuration (username, vhost, and
115+
cluster)
116+
properties:
117+
cluster:
118+
description: Name of the cluster
119+
minLength: 1
120+
type: string
121+
user:
122+
description: User - RabbitMQ username
123+
type: string
124+
vhost:
125+
description: Vhost - RabbitMQ vhost name
126+
type: string
127+
required:
128+
- cluster
129+
type: object
113130
networkAttachmentDefinitions:
114131
description: NetworkAttachmentDefinitions list of network attachment
115132
definitions the service pod gets attached to
@@ -122,6 +139,23 @@ spec:
122139
description: NodeSelector to target subset of worker nodes running
123140
this service
124141
type: object
142+
notificationsBus:
143+
description: NotificationsBus configuration (username, vhost,
144+
and cluster) for notifications
145+
properties:
146+
cluster:
147+
description: Name of the cluster
148+
minLength: 1
149+
type: string
150+
user:
151+
description: User - RabbitMQ username
152+
type: string
153+
vhost:
154+
description: Vhost - RabbitMQ vhost name
155+
type: string
156+
required:
157+
- cluster
158+
type: object
125159
notifierImage:
126160
type: string
127161
override:
@@ -315,6 +349,7 @@ spec:
315349
description: |-
316350
RabbitMQ instance name
317351
Needed to request a transportURL that is created and used in Aodh
352+
Deprecated: Use MessagingBus.Cluster instead
318353
type: string
319354
secret:
320355
default: osp-secret
@@ -502,6 +537,10 @@ spec:
502537
items:
503538
type: string
504539
type: array
540+
notificationsURLSecret:
541+
description: NotificationsURLSecret - Secret containing RabbitMQ notification
542+
transportURL
543+
type: string
505544
observedGeneration:
506545
description: |-
507546
ObservedGeneration - the most recent generation observed for this

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ spec:
159159
description: SecretName - holding the cert, key for the service
160160
type: string
161161
type: object
162+
messagingBus:
163+
description: MessagingBus configuration (username, vhost, and cluster)
164+
properties:
165+
cluster:
166+
description: Name of the cluster
167+
minLength: 1
168+
type: string
169+
user:
170+
description: User - RabbitMQ username
171+
type: string
172+
vhost:
173+
description: Vhost - RabbitMQ vhost name
174+
type: string
175+
required:
176+
- cluster
177+
type: object
162178
mysqldExporterDatabaseAccountPrefix:
163179
default: mysqld-exporter
164180
description: |-
@@ -199,6 +215,23 @@ spec:
199215
type: object
200216
notificationImage:
201217
type: string
218+
notificationsBus:
219+
description: NotificationsBus configuration (username, vhost, and
220+
cluster) for notifications
221+
properties:
222+
cluster:
223+
description: Name of the cluster
224+
minLength: 1
225+
type: string
226+
user:
227+
description: User - RabbitMQ username
228+
type: string
229+
vhost:
230+
description: Vhost - RabbitMQ vhost name
231+
type: string
232+
required:
233+
- cluster
234+
type: object
202235
passwordSelector:
203236
default:
204237
ceilometerService: CeilometerPassword
@@ -228,6 +261,7 @@ spec:
228261
description: |-
229262
RabbitMQ instance name
230263
Needed to request a transportURL that is created and used in Telemetry
264+
Deprecated: Use MessagingBus.Cluster instead
231265
type: string
232266
secret:
233267
default: osp-secret
@@ -373,6 +407,10 @@ spec:
373407
items:
374408
type: string
375409
type: array
410+
notificationsURLSecret:
411+
description: NotificationsURLSecret - Secret containing RabbitMQ notification
412+
transportURL
413+
type: string
376414
observedGeneration:
377415
description: |-
378416
ObservedGeneration - the most recent generation observed for this

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

Lines changed: 38 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
@@ -552,6 +568,23 @@ spec:
552568
NodeSelector here acts as a default value and can be overridden by service
553569
specific NodeSelector Settings.
554570
type: object
571+
notificationsBus:
572+
description: NotificationsBus configuration (username, vhost, and
573+
cluster) for notifications
574+
properties:
575+
cluster:
576+
description: Name of the cluster
577+
minLength: 1
578+
type: string
579+
user:
580+
description: User - RabbitMQ username
581+
type: string
582+
vhost:
583+
description: Vhost - RabbitMQ vhost name
584+
type: string
585+
required:
586+
- cluster
587+
type: object
555588
passwordSelector:
556589
default:
557590
cloudKittyService: CloudKittyPassword
@@ -623,6 +656,7 @@ spec:
623656
description: |-
624657
RabbitMQ instance name
625658
Needed to request a transportURL that is created and used in CloudKitty
659+
Deprecated: Use MessagingBus.Cluster instead
626660
type: string
627661
s3StorageConfig:
628662
default:
@@ -792,6 +826,10 @@ spec:
792826
type: string
793827
description: Map of hashes to track e.g. job status
794828
type: object
829+
notificationsURLSecret:
830+
description: NotificationsURLSecret - Secret containing RabbitMQ notification
831+
transportURL
832+
type: string
795833
observedGeneration:
796834
description: |-
797835
ObservedGeneration - the most recent generation observed for this service.

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

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ spec:
113113
default: memcached
114114
description: Memcached instance name.
115115
type: string
116+
messagingBus:
117+
description: MessagingBus configuration (username, vhost,
118+
and cluster)
119+
properties:
120+
cluster:
121+
description: Name of the cluster
122+
minLength: 1
123+
type: string
124+
user:
125+
description: User - RabbitMQ username
126+
type: string
127+
vhost:
128+
description: Vhost - RabbitMQ vhost name
129+
type: string
130+
required:
131+
- cluster
132+
type: object
116133
networkAttachmentDefinitions:
117134
description: NetworkAttachmentDefinitions list of network
118135
attachment definitions the service pod gets attached to
@@ -125,6 +142,23 @@ spec:
125142
description: NodeSelector to target subset of worker nodes
126143
running this service
127144
type: object
145+
notificationsBus:
146+
description: NotificationsBus configuration (username, vhost,
147+
and cluster) for notifications
148+
properties:
149+
cluster:
150+
description: Name of the cluster
151+
minLength: 1
152+
type: string
153+
user:
154+
description: User - RabbitMQ username
155+
type: string
156+
vhost:
157+
description: Vhost - RabbitMQ vhost name
158+
type: string
159+
required:
160+
- cluster
161+
type: object
128162
notifierImage:
129163
type: string
130164
override:
@@ -318,6 +352,7 @@ spec:
318352
description: |-
319353
RabbitMQ instance name
320354
Needed to request a transportURL that is created and used in Aodh
355+
Deprecated: Use MessagingBus.Cluster instead
321356
type: string
322357
secret:
323358
default: osp-secret
@@ -487,6 +522,23 @@ spec:
487522
description: SecretName - holding the cert, key for the service
488523
type: string
489524
type: object
525+
messagingBus:
526+
description: MessagingBus configuration (username, vhost, and
527+
cluster)
528+
properties:
529+
cluster:
530+
description: Name of the cluster
531+
minLength: 1
532+
type: string
533+
user:
534+
description: User - RabbitMQ username
535+
type: string
536+
vhost:
537+
description: Vhost - RabbitMQ vhost name
538+
type: string
539+
required:
540+
- cluster
541+
type: object
490542
mysqldExporterDatabaseAccountPrefix:
491543
default: mysqld-exporter
492544
description: |-
@@ -527,6 +579,23 @@ spec:
527579
type: object
528580
notificationImage:
529581
type: string
582+
notificationsBus:
583+
description: NotificationsBus configuration (username, vhost,
584+
and cluster) for notifications
585+
properties:
586+
cluster:
587+
description: Name of the cluster
588+
minLength: 1
589+
type: string
590+
user:
591+
description: User - RabbitMQ username
592+
type: string
593+
vhost:
594+
description: Vhost - RabbitMQ vhost name
595+
type: string
596+
required:
597+
- cluster
598+
type: object
530599
passwordSelector:
531600
default:
532601
ceilometerService: CeilometerPassword
@@ -556,6 +625,7 @@ spec:
556625
description: |-
557626
RabbitMQ instance name
558627
Needed to request a transportURL that is created and used in Telemetry
628+
Deprecated: Use MessagingBus.Cluster instead
559629
type: string
560630
secret:
561631
default: osp-secret
@@ -1112,6 +1182,23 @@ spec:
11121182
default: memcached
11131183
description: Memcached instance name.
11141184
type: string
1185+
messagingBus:
1186+
description: MessagingBus configuration (username, vhost, and
1187+
cluster)
1188+
properties:
1189+
cluster:
1190+
description: Name of the cluster
1191+
minLength: 1
1192+
type: string
1193+
user:
1194+
description: User - RabbitMQ username
1195+
type: string
1196+
vhost:
1197+
description: Vhost - RabbitMQ vhost name
1198+
type: string
1199+
required:
1200+
- cluster
1201+
type: object
11151202
nodeSelector:
11161203
additionalProperties:
11171204
type: string
@@ -1120,6 +1207,23 @@ spec:
11201207
NodeSelector here acts as a default value and can be overridden by service
11211208
specific NodeSelector Settings.
11221209
type: object
1210+
notificationsBus:
1211+
description: NotificationsBus configuration (username, vhost,
1212+
and cluster) for notifications
1213+
properties:
1214+
cluster:
1215+
description: Name of the cluster
1216+
minLength: 1
1217+
type: string
1218+
user:
1219+
description: User - RabbitMQ username
1220+
type: string
1221+
vhost:
1222+
description: Vhost - RabbitMQ vhost name
1223+
type: string
1224+
required:
1225+
- cluster
1226+
type: object
11231227
passwordSelector:
11241228
default:
11251229
cloudKittyService: CloudKittyPassword
@@ -1192,6 +1296,7 @@ spec:
11921296
description: |-
11931297
RabbitMQ instance name
11941298
Needed to request a transportURL that is created and used in CloudKitty
1299+
Deprecated: Use MessagingBus.Cluster instead
11951300
type: string
11961301
s3StorageConfig:
11971302
default:

‎api/go.mod‎

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

55
require (
6+
github.com/onsi/gomega v1.38.3
67
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260108154501-11e5091cddf1
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
@@ -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
@@ -43,6 +43,7 @@ require (
4343
github.com/prometheus/client_model v0.6.2 // indirect
4444
github.com/prometheus/common v0.65.0 // indirect
4545
github.com/prometheus/procfs v0.16.1 // indirect
46+
github.com/rabbitmq/cluster-operator/v2 v2.16.0 // indirect
4647
github.com/rhobs/obo-prometheus-operator/pkg/apis/monitoring v0.71.0-rhobs1 // indirect
4748
github.com/spf13/pflag v1.0.7 // indirect
4849
github.com/x448/float16 v0.8.4 // indirect

0 commit comments

Comments
 (0)