Skip to content

Commit e142029

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. 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 e142029

File tree

11 files changed

+136
-10
lines changed

11 files changed

+136
-10
lines changed

api/bases/keystone.openstack.org_keystoneapis.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,16 @@ 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+
user:
1469+
description: User - RabbitMQ username
1470+
type: string
1471+
vhost:
1472+
description: Vhost - RabbitMQ vhost name
1473+
type: string
1474+
type: object
14651475
region:
14661476
default: regionOne
14671477
description: Region - optional region name for the keystone service

api/go.mod

Lines changed: 5 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
@@ -96,4 +96,7 @@ replace k8s.io/code-generator => k8s.io/code-generator v0.31.14 //allow-merging
9696

9797
replace k8s.io/component-base => k8s.io/component-base v0.31.14 //allow-merging
9898

99+
// custom RabbitmqClusterSpecCore for OpenStackControlplane (v2.16.0_patches)
100+
replace github.com/rabbitmq/cluster-operator/v2 => github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec //allow-merging
101+
99102
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=
@@ -85,8 +86,8 @@ github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
8586
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
8687
github.com/openshift/api v0.0.0-20250711200046-c86d80652a9e h1:E1OdwSpqWuDPCedyUt0GEdoAE+r5TXy7YS21yNEo+2U=
8788
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=
89+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb h1:R81bAZaAxF0SdUecxsP5pxqVqP8MTFnhCfLZWixCOIw=
90+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
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/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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,16 @@ 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+
user:
1469+
description: User - RabbitMQ username
1470+
type: string
1471+
vhost:
1472+
description: Vhost - RabbitMQ vhost name
1473+
type: string
1474+
type: object
14651475
region:
14661476
default: regionOne
14671477
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: 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.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

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.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
118118
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
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.20251205192058-5cfbada0ab96 h1:hPgCcrbRHBPfngaEPe6coaCtcauMolI71lfcLdinrKI=
122-
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251205192058-5cfbada0ab96/go.mod h1:ZuglN7IqXfIo75WcJwe0NLHhu82Fs3k/5IXptqnO1H4=
121+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb h1:R81bAZaAxF0SdUecxsP5pxqVqP8MTFnhCfLZWixCOIw=
122+
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20251215110339-4871011e89fb/go.mod h1:ex8ou6/3ms6ovR+CMXD6XhTlNakm1GhB6UZgagVRNW8=
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=

internal/controller/keystoneapi_controller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,13 @@ func (r *KeystoneAPIReconciler) transportURLCreateOrUpdate(
12871287
}
12881288
op, err := controllerutil.CreateOrUpdate(ctx, r.Client, transportURL, func() error {
12891289
transportURL.Spec.RabbitmqClusterName = instance.Spec.RabbitMqClusterName
1290-
err := controllerutil.SetControllerReference(instance, transportURL, r.Scheme)
1291-
return err
1290+
if instance.Spec.RabbitMq.User != "" {
1291+
transportURL.Spec.Username = instance.Spec.RabbitMq.User
1292+
}
1293+
if instance.Spec.RabbitMq.Vhost != "" {
1294+
transportURL.Spec.Vhost = instance.Spec.RabbitMq.Vhost
1295+
}
1296+
return controllerutil.SetControllerReference(instance, transportURL, r.Scheme)
12921297
})
12931298

12941299
return transportURL, op, err

0 commit comments

Comments
 (0)