Skip to content

Commit 971035f

Browse files
committed
Rabbitmq vhost and user support
Add optional rabbitmq.user and rabbitmq.vhost fields to the spec to allow configuring custom RabbitMQ credentials and virtual hosts. The controller sets these values on the TransportURL when specified. Additionally, we migrate RabbitMQ cluster name to RabbitMq config struct using DefaultRabbitMqConfig from infra-operator to automatically populate RabbitMq.ClusterName from legacy RabbitMqClusterName field. Controller now uses RabbitMq.ClusterName as the source of truth. Includes functional tests verifying custom and default configurations. Example usage: spec: rabbitmq: user: custom-user vhost: custom-vhost Jira: https://issues.redhat.com/browse/OSPRH-22689
1 parent 593df0a commit 971035f

File tree

12 files changed

+151
-11
lines changed

12 files changed

+151
-11
lines changed

api/bases/keystone.openstack.org_keystoneapis.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,19 @@ spec:
14621462
RabbitMQ instance name
14631463
Needed to request a transportURL that is created and used in Keystone
14641464
type: string
1465+
rabbitmq:
1466+
description: RabbitMQ configuration (username and vhost)
1467+
properties:
1468+
clusterName:
1469+
description: Name of the cluster
1470+
type: string
1471+
user:
1472+
description: User - RabbitMQ username
1473+
type: string
1474+
vhost:
1475+
description: Vhost - RabbitMQ vhost name
1476+
type: string
1477+
type: object
14651478
region:
14661479
default: regionOne
14671480
description: Region - optional region name for the keystone service

api/go.mod

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/google/uuid v1.6.0
88
github.com/gophercloud/gophercloud/v2 v2.8.0
99
github.com/onsi/gomega v1.38.2
10-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96
10+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb
1111
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c
1212
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c
1313
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c
@@ -24,7 +24,6 @@ require (
2424
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2525
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2626
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
27-
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
2827
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
2928
github.com/fsnotify/fsnotify v1.9.0 // indirect
3029
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
@@ -51,6 +50,7 @@ require (
5150
github.com/prometheus/client_model v0.6.2 // indirect
5251
github.com/prometheus/common v0.65.0 // indirect
5352
github.com/prometheus/procfs v0.16.1 // indirect
53+
github.com/rabbitmq/cluster-operator/v2 v2.16.0 // indirect
5454
github.com/spf13/pflag v1.0.7 // indirect
5555
github.com/x448/float16 v0.8.4 // indirect
5656
go.yaml.in/yaml/v2 v2.4.2 // indirect
@@ -75,6 +75,9 @@ require (
7575
sigs.k8s.io/yaml v1.6.0 // indirect
7676
)
7777

78+
// Temporary replacement for infra-operator PR #515 (RabbitMQ defaulting function)
79+
replace github.com/openstack-k8s-operators/infra-operator/apis => github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6
80+
7881
// mschuppert: map to latest commit from release-4.18 tag
7982
// must consistent within modules and service operators
8083
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e //allow-merging
@@ -96,4 +99,7 @@ replace k8s.io/code-generator => k8s.io/code-generator v0.31.14 //allow-merging
9699

97100
replace k8s.io/component-base => k8s.io/component-base v0.31.14 //allow-merging
98101

102+
// custom RabbitmqClusterSpecCore for OpenStackControlplane (v2.16.0_patches)
103+
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec //allow-merging
104+
99105
replace k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20250627150254-e9823e99808e //allow-merging

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=
@@ -68,6 +69,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6869
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
6970
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
7071
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
72+
github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6 h1:qlWlrXWG1Qwv5k/5a9QjrbTrfbqgVH0ifgf4XvWMTnI=
73+
github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
7174
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
7275
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
7376
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -85,8 +88,6 @@ github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
8588
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
8689
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
8790
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
88-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96 h1:hPgCcrbRHBPfngaEPe6coaCtcauMolI71lfcLdinrKI=
89-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96/go.mod h1:ZuglN7IqXfIo75WcJwe0NLHhu82Fs3k/5IXptqnO1H4=
9091
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c h1:wM8qXCB5mQwSosCvtaydzuXitWVVKBHTzH0A2znQ+Jg=
9192
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:+Me0raWPPdz8gRi9D4z1khmvUgS9vIKAVC8ckg1yJZU=
9293
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c h1:l7FO+XoQRnD4aT5p/JXVY2uezQLdC7D50KrwrTmzCfg=
@@ -95,6 +96,8 @@ github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.202511221
9596
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:fy1lvz3uuzzh01DKKdgroXvmJgMpJBsvl2r9eTtAll0=
9697
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20251122131503-b76943960b6c h1:YdTv3RXKfFg2QHXtLJSnKaPruslyp1Fd+ArcsxLcy6k=
9798
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:lgYyrXEYA2BPsq4Kg6dqa+QsHgOjMPyOsEYrvyYW3jk=
99+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
100+
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
98101
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
99102
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
100103
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

api/v1beta1/keystoneapi_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1beta1
1919
import (
2020
"fmt"
2121

22+
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
2223
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
2324
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2425
"github.com/openstack-k8s-operators/lib-common/modules/common/endpoint"
@@ -213,6 +214,10 @@ type KeystoneAPISpecCore struct {
213214
// This is only needed when multiple realms are federated.
214215
// Config files mount path is set to /var/lib/httpd/metadata/
215216
FederatedRealmConfig string `json:"federatedRealmConfig"`
217+
218+
// +kubebuilder:validation:Optional
219+
// RabbitMQ configuration (username and vhost)
220+
RabbitMq rabbitmqv1.RabbitMqConfig `json:"rabbitmq,omitempty"`
216221
}
217222

218223
// APIOverrideSpec to override the generated manifest of several child resources.

api/v1beta1/keystoneapi_webhook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package v1beta1
2525
import (
2626
"fmt"
2727

28+
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
2829
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
2930
apierrors "k8s.io/apimachinery/pkg/api/errors"
3031
"k8s.io/apimachinery/pkg/runtime"
@@ -76,6 +77,7 @@ func (spec *KeystoneAPISpecCore) Default() {
7677
if spec.APITimeout == 0 {
7778
spec.APITimeout = keystoneAPIDefaults.APITimeout
7879
}
80+
rabbitmqv1.DefaultRabbitMqConfig(&spec.RabbitMq, spec.RabbitMqClusterName)
7981
}
8082

8183
var _ webhook.Validator = &KeystoneAPI{}

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/keystone.openstack.org_keystoneapis.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,19 @@ spec:
14621462
RabbitMQ instance name
14631463
Needed to request a transportURL that is created and used in Keystone
14641464
type: string
1465+
rabbitmq:
1466+
description: RabbitMQ configuration (username and vhost)
1467+
properties:
1468+
clusterName:
1469+
description: Name of the cluster
1470+
type: string
1471+
user:
1472+
description: User - RabbitMQ username
1473+
type: string
1474+
vhost:
1475+
description: Vhost - RabbitMQ vhost name
1476+
type: string
1477+
type: object
14651478
region:
14661479
default: regionOne
14671480
description: Region - optional region name for the keystone service

config/manifests/bases/keystone-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ spec:
6161
- name: Keystone Operator
6262
url: https://github.com/openstack-k8s-operators/keystone-operator
6363
maturity: beta
64+
minKubeVersion: 0.0.0
6465
provider:
6566
name: Red Hat Inc.
6667
url: https://redhat.com/
6768
version: 0.0.0
68-
minKubeVersion: 0.0.0

go.mod

Lines changed: 4 additions & 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.2
1010
github.com/onsi/gomega v1.38.2
11-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96
11+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb
1212
github.com/openstack-k8s-operators/keystone-operator/api v0.3.1-0.20240213125925-e40975f3db7e
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/openstack v0.6.1-0.20251122131503-b76943960b6c
@@ -116,6 +116,9 @@ require (
116116

117117
replace github.com/openstack-k8s-operators/keystone-operator/api => ./api
118118

119+
// Temporary replacement for infra-operator PR #515 (RabbitMQ defaulting function)
120+
replace github.com/openstack-k8s-operators/infra-operator/apis => github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6
121+
119122
// mschuppert: map to latest commit from release-4.18 tag
120123
// must consistent within modules and service operators
121124
replace github.com/openshift/api => github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e //allow-merging

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
9898
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
9999
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
100100
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
101+
github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6 h1:qlWlrXWG1Qwv5k/5a9QjrbTrfbqgVH0ifgf4XvWMTnI=
102+
github.com/lmiccini/infra-operator/apis v0.0.0-20251217042440-c46991a7cfd6/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
101103
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
102104
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
103105
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
@@ -118,8 +120,6 @@ github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
118120
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
119121
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
120122
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.20251205192058-5cfbada0ab96 h1:hPgCcrbRHBPfngaEPe6coaCtcauMolI71lfcLdinrKI=
122-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96/go.mod h1:ZuglN7IqXfIo75WcJwe0NLHhu82Fs3k/5IXptqnO1H4=
123123
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c h1:wM8qXCB5mQwSosCvtaydzuXitWVVKBHTzH0A2znQ+Jg=
124124
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20251122131503-b76943960b6c/go.mod h1:+Me0raWPPdz8gRi9D4z1khmvUgS9vIKAVC8ckg1yJZU=
125125
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20251122131503-b76943960b6c h1:l7FO+XoQRnD4aT5p/JXVY2uezQLdC7D50KrwrTmzCfg=

0 commit comments

Comments
 (0)