Skip to content

Commit 8b30c5e

Browse files
committed
Rabbitmq vhost and user support
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-23882
1 parent add353f commit 8b30c5e

21 files changed

Lines changed: 1029 additions & 65 deletions

‎api/bases/watcher.openstack.org_watchers.yaml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,46 @@ spec:
608608
description: MemcachedInstance is the name of the Memcached CR that
609609
all watcher service will use.
610610
type: string
611+
messagingBus:
612+
description: MessagingBus configuration (username, vhost, and cluster)
613+
properties:
614+
cluster:
615+
description: Name of the cluster
616+
minLength: 1
617+
type: string
618+
user:
619+
description: User - RabbitMQ username
620+
type: string
621+
vhost:
622+
description: Vhost - RabbitMQ vhost name
623+
type: string
624+
required:
625+
- cluster
626+
type: object
611627
nodeSelector:
612628
additionalProperties:
613629
type: string
614630
description: |-
615631
NodeSelector to target subset of worker nodes running this component. Setting here overrides
616632
any global NodeSelector settings within the Watcher CR.
617633
type: object
634+
notificationsBus:
635+
description: NotificationsBus configuration (username, vhost, and
636+
cluster) for notifications
637+
properties:
638+
cluster:
639+
description: Name of the cluster
640+
minLength: 1
641+
type: string
642+
user:
643+
description: User - RabbitMQ username
644+
type: string
645+
vhost:
646+
description: Vhost - RabbitMQ vhost name
647+
type: string
648+
required:
649+
- cluster
650+
type: object
618651
notificationsBusInstance:
619652
description: |-
620653
NotificationsBusInstance is the name of the RabbitMqCluster CR to select
@@ -623,6 +656,7 @@ spec:
623656
If undefined, the value will be inherited from OpenStackControlPlane.
624657
An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all.
625658
Avoid colocating it with RabbitMqClusterName or other message bus instances used for RPC.
659+
Deprecated: Use NotificationsBus.Cluster instead
626660
type: string
627661
passwordSelectors:
628662
default:
@@ -650,6 +684,7 @@ spec:
650684
description: |-
651685
RabbitMQ instance name
652686
Needed to request a transportURL that is created and used in Watcher
687+
Deprecated: Use MessagingBus.Cluster instead
653688
type: string
654689
secret:
655690
default: osp-secret

‎api/go.mod‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.24.4
55
toolchain go1.24.6
66

77
require (
8-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260115124008-0121df869109
9-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35
8+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09
9+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260126081203-efc2df9207eb
1010
k8s.io/api v0.31.14
1111
k8s.io/apimachinery v0.31.14
1212
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
@@ -18,7 +18,6 @@ require (
1818
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1919
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2020
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
21-
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2221
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2322
github.com/fsnotify/fsnotify v1.9.0 // indirect
2423
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -40,12 +39,12 @@ require (
4039
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4140
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4241
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
43-
github.com/onsi/gomega v1.39.0 // indirect
4442
github.com/pkg/errors v0.9.1 // indirect
4543
github.com/prometheus/client_golang v1.22.0 // indirect
4644
github.com/prometheus/client_model v0.6.2 // indirect
4745
github.com/prometheus/common v0.65.0 // indirect
4846
github.com/prometheus/procfs v0.16.1 // indirect
47+
github.com/rabbitmq/cluster-operator/v2 v2.16.0 // indirect
4948
github.com/spf13/pflag v1.0.7 // indirect
5049
github.com/x448/float16 v0.8.4 // indirect
5150
go.yaml.in/yaml/v2 v2.4.2 // indirect

‎api/go.sum‎

Lines changed: 7 additions & 4 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=
@@ -78,10 +79,12 @@ github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8
7879
github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
7980
github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q=
8081
github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
81-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260115124008-0121df869109 h1:S+A67nntHZrL1lIL3qr91CpJj+A67M/G4t1cTKzeGdo=
82-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260115124008-0121df869109/go.mod h1:ZXwFlspJCdZEUjMbmaf61t5AMB4u2vMyAMMoe/vJroE=
83-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35 h1:pF3mJ3nwq6r4qwom+rEWZNquZpcQW/iftHlJ1KPIDsk=
84-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251230215914-6ba873b49a35/go.mod h1:kycZyoe7OZdW1HUghr2nI3N7wSJtNahXf6b/ypD14f4=
82+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09 h1:vhAGLKZitJIffj7ONiPpKmOX7Tmt/LGJpaY0Z2LeyfQ=
83+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09/go.mod h1:ZXwFlspJCdZEUjMbmaf61t5AMB4u2vMyAMMoe/vJroE=
84+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260126081203-efc2df9207eb h1:S7tnYO/E1f1KQfcp7N5bam8+ax/ExDTOhZ1WqG4Bfu0=
85+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260126081203-efc2df9207eb/go.mod h1:ndqfy1KbVorHH6+zlUFPIrCRhMSxO3ImYJUGaooE0x0=
86+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
87+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
8588
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8689
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8790
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

‎api/v1beta1/common_types.go‎

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

1919
import (
20-
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
21-
20+
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
2221
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
22+
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
2323

2424
corev1 "k8s.io/api/core/v1"
2525
)
@@ -83,10 +83,19 @@ type WatcherSpecCore struct {
8383
// Important: Run "make" to regenerate code after modifying this file
8484
WatcherCommon `json:",inline"`
8585

86+
// +kubebuilder:validation:Optional
87+
// MessagingBus configuration (username, vhost, and cluster)
88+
MessagingBus rabbitmqv1.RabbitMqConfig `json:"messagingBus,omitempty"`
89+
90+
// +kubebuilder:validation:Optional
91+
// NotificationsBus configuration (username, vhost, and cluster) for notifications
92+
NotificationsBus *rabbitmqv1.RabbitMqConfig `json:"notificationsBus,omitempty"`
93+
8694
// +kubebuilder:validation:Required
8795
// +kubebuilder:default=rabbitmq
8896
// RabbitMQ instance name
8997
// Needed to request a transportURL that is created and used in Watcher
98+
// Deprecated: Use MessagingBus.Cluster instead
9099
RabbitMqClusterName *string `json:"rabbitMqClusterName"`
91100

92101
// +kubebuilder:validation:Optional
@@ -136,6 +145,7 @@ type WatcherSpecCore struct {
136145
// If undefined, the value will be inherited from OpenStackControlPlane.
137146
// An empty value "" leaves the notification drivers unconfigured and emitting no notifications at all.
138147
// Avoid colocating it with RabbitMqClusterName or other message bus instances used for RPC.
148+
// Deprecated: Use NotificationsBus.Cluster instead
139149
NotificationsBusInstance *string `json:"notificationsBusInstance,omitempty"`
140150
}
141151

0 commit comments

Comments
 (0)