Skip to content

Commit 6c1f05a

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-22694
1 parent f9d7fba commit 6c1f05a

File tree

12 files changed

+505
-12
lines changed

12 files changed

+505
-12
lines changed

api/bases/cinder.openstack.org_cinders.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,22 @@ spec:
20242024
default: memcached
20252025
description: Memcached instance name.
20262026
type: string
2027+
messagingBus:
2028+
description: MessagingBus configuration (username, vhost, and cluster)
2029+
properties:
2030+
cluster:
2031+
description: Name of the cluster
2032+
minLength: 1
2033+
type: string
2034+
user:
2035+
description: User - RabbitMQ username
2036+
type: string
2037+
vhost:
2038+
description: Vhost - RabbitMQ vhost name
2039+
type: string
2040+
required:
2041+
- cluster
2042+
type: object
20272043
nodeSelector:
20282044
additionalProperties:
20292045
type: string
@@ -2032,6 +2048,23 @@ spec:
20322048
NodeSelector here acts as a default value and can be overridden by service
20332049
specific NodeSelector Settings.
20342050
type: object
2051+
notificationsBus:
2052+
description: NotificationsBus configuration (username, vhost, and
2053+
cluster) for notifications
2054+
properties:
2055+
cluster:
2056+
description: Name of the cluster
2057+
minLength: 1
2058+
type: string
2059+
user:
2060+
description: User - RabbitMQ username
2061+
type: string
2062+
vhost:
2063+
description: Vhost - RabbitMQ vhost name
2064+
type: string
2065+
required:
2066+
- cluster
2067+
type: object
20352068
notificationsBusInstance:
20362069
description: |-
20372070
RabbitMQ instance name used to request a transportURL that is used for

api/go.mod

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

55
require (
6-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251206161943-786269345f99
6+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e
77
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c
88
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c
99
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
@@ -17,7 +17,6 @@ require (
1717
github.com/cespare/xxhash/v2 v2.3.0 // indirect
1818
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1919
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
20-
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2120
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2221
github.com/fsnotify/fsnotify v1.9.0 // indirect
2322
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -46,6 +45,7 @@ require (
4645
github.com/prometheus/client_model v0.6.2 // indirect
4746
github.com/prometheus/common v0.65.0 // indirect
4847
github.com/prometheus/procfs v0.16.1 // indirect
48+
github.com/rabbitmq/cluster-operator/v2 v2.16.0 // indirect
4949
github.com/spf13/pflag v1.0.7 // indirect
5050
github.com/x448/float16 v0.8.4 // indirect
5151
go.yaml.in/yaml/v2 v2.4.2 // indirect

api/go.sum

Lines changed: 5 additions & 2 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,12 +79,14 @@ 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.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
8081
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.20251206161943-786269345f99 h1:J9SzxfFmQQEMpfoCtpKUd87LtQXLWGZORL+6nBdtP+w=
82-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251206161943-786269345f99/go.mod h1:UgaMi5mHTvaGYLdPKwewSnYiSm75P+vowRqbqknHlbw=
82+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e h1:PIjcXzMMwfvBRFgFpaq/W9tqy0t2cYvcWX+kq6uNtTM=
83+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
8384
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c h1:wM8qXCB5mQwSosCvtaydzuXitWVVKBHTzH0A2znQ+Jg=
8485
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:+Me0raWPPdz8gRi9D4z1khmvUgS9vIKAVC8ckg1yJZU=
8586
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c h1:dVIaDL5BeIdJjERGaN/XlcvZVplfkzh0uUfiVUHj/6Q=
8687
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:fy1lvz3uuzzh01DKKdgroXvmJgMpJBsvl2r9eTtAll0=
88+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
89+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
8790
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8891
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8992
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

api/v1beta1/cinder_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
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2223
"github.com/openstack-k8s-operators/lib-common/modules/storage"
@@ -70,6 +71,14 @@ type CinderSpecBase struct {
7071
// Needed to request a transportURL that is created and used in Cinder
7172
RabbitMqClusterName string `json:"rabbitMqClusterName"`
7273

74+
// +kubebuilder:validation:Optional
75+
// MessagingBus configuration (username, vhost, and cluster)
76+
MessagingBus rabbitmqv1.RabbitMqConfig `json:"messagingBus,omitempty"`
77+
78+
// +kubebuilder:validation:Optional
79+
// NotificationsBus configuration (username, vhost, and cluster) for notifications
80+
NotificationsBus *rabbitmqv1.RabbitMqConfig `json:"notificationsBus,omitempty"`
81+
7382
// +kubebuilder:validation:Required
7483
// +kubebuilder:default=memcached
7584
// Memcached instance name.

api/v1beta1/cinder_webhook.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"golang.org/x/exp/maps"
2828

29+
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
2930
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
3031
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
3132
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
@@ -111,6 +112,19 @@ func (r *Cinder) Default() {
111112

112113
// Default - set defaults for this Cinder spec
113114
func (spec *CinderSpecBase) Default() {
115+
rabbitmqv1.DefaultRabbitMqConfig(&spec.MessagingBus, spec.RabbitMqClusterName)
116+
117+
// Default NotificationsBus if NotificationsBusInstance is specified
118+
if spec.NotificationsBusInstance != nil && *spec.NotificationsBusInstance != "" {
119+
if spec.NotificationsBus == nil {
120+
// Initialize NotificationsBus with MessagingBus values to inherit user/vhost
121+
spec.NotificationsBus = &rabbitmqv1.RabbitMqConfig{
122+
User: spec.MessagingBus.User,
123+
Vhost: spec.MessagingBus.Vhost,
124+
}
125+
}
126+
rabbitmqv1.DefaultRabbitMqConfig(spec.NotificationsBus, *spec.NotificationsBusInstance)
127+
}
114128

115129
if spec.DBPurge.Age == 0 {
116130
spec.DBPurge.Age = cinderDefaults.DBPurgeAge

api/v1beta1/conditions.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const (
3232

3333
// CinderVolumeReadyCondition Status=True condition which indicates if the CinderVolume is configured and operational
3434
CinderVolumeReadyCondition condition.Type = "CinderVolumeReady"
35+
36+
// CinderNotificationBusReadyCondition Status=True condition which indicates if the NotificationBus is configured
37+
CinderNotificationBusReadyCondition condition.Type = "CinderNotificationBusReady"
3538
)
3639

3740
// Cinder Reasons used by API objects.
@@ -77,4 +80,19 @@ const (
7780

7881
// CinderVolumeReadyRunningMessage
7982
CinderVolumeReadyRunningMessage = "CinderVolume deployments in progress"
83+
84+
//
85+
// CinderNotificationBusReady condition messages
86+
//
87+
// CinderNotificationBusReadyInitMessage
88+
CinderNotificationBusReadyInitMessage = "CinderNotificationBus not started"
89+
90+
// CinderNotificationBusReadyRunningMessage
91+
CinderNotificationBusReadyRunningMessage = "CinderNotificationBus creation in progress"
92+
93+
// CinderNotificationBusReadyMessage
94+
CinderNotificationBusReadyMessage = "CinderNotificationBus successfully created"
95+
96+
// CinderNotificationBusReadyErrorMessage
97+
CinderNotificationBusReadyErrorMessage = "CinderNotificationBus error occured %s"
8098
)

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/cinder.openstack.org_cinders.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,22 @@ spec:
20242024
default: memcached
20252025
description: Memcached instance name.
20262026
type: string
2027+
messagingBus:
2028+
description: MessagingBus configuration (username, vhost, and cluster)
2029+
properties:
2030+
cluster:
2031+
description: Name of the cluster
2032+
minLength: 1
2033+
type: string
2034+
user:
2035+
description: User - RabbitMQ username
2036+
type: string
2037+
vhost:
2038+
description: Vhost - RabbitMQ vhost name
2039+
type: string
2040+
required:
2041+
- cluster
2042+
type: object
20272043
nodeSelector:
20282044
additionalProperties:
20292045
type: string
@@ -2032,6 +2048,23 @@ spec:
20322048
NodeSelector here acts as a default value and can be overridden by service
20332049
specific NodeSelector Settings.
20342050
type: object
2051+
notificationsBus:
2052+
description: NotificationsBus configuration (username, vhost, and
2053+
cluster) for notifications
2054+
properties:
2055+
cluster:
2056+
description: Name of the cluster
2057+
minLength: 1
2058+
type: string
2059+
user:
2060+
description: User - RabbitMQ username
2061+
type: string
2062+
vhost:
2063+
description: Vhost - RabbitMQ vhost name
2064+
type: string
2065+
required:
2066+
- cluster
2067+
type: object
20352068
notificationsBusInstance:
20362069
description: |-
20372070
RabbitMQ instance name used to request a transportURL that is used for

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/k8snetworkplumbingwg/network-attachment-definition-client v1.7.7
99
github.com/onsi/ginkgo/v2 v2.27.3
1010
github.com/onsi/gomega v1.38.3
11-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251206161943-786269345f99
11+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e
1212
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20251206133124-593df0a7a9e1
1313
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c
1414
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
118118
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
119119
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
120120
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
121-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251206161943-786269345f99 h1:J9SzxfFmQQEMpfoCtpKUd87LtQXLWGZORL+6nBdtP+w=
122-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251206161943-786269345f99/go.mod h1:UgaMi5mHTvaGYLdPKwewSnYiSm75P+vowRqbqknHlbw=
121+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e h1:PIjcXzMMwfvBRFgFpaq/W9tqy0t2cYvcWX+kq6uNtTM=
122+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251217131115-0f117a938d4e/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
123123
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20251206133124-593df0a7a9e1 h1:qcgbrF9c0axkaDcFGfIA2wGz8bkaxPuXHj3mdKAyz6M=
124124
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20251206133124-593df0a7a9e1/go.mod h1:0XsZ6Fc4hTV6a/BBP8+jiH8LR+IP5z9aStdPTDHALNk=
125125
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c h1:wM8qXCB5mQwSosCvtaydzuXitWVVKBHTzH0A2znQ+Jg=

0 commit comments

Comments
 (0)