Skip to content

Commit ebc58fb

Browse files
committed
Make deprecated parameter optional
1 parent d876cea commit ebc58fb

19 files changed

+122
-80
lines changed

api/bases/nova.openstack.org_nova.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ spec:
5454
Service instance used for the Nova API DB.
5555
type: string
5656
apiMessageBusInstance:
57-
default: rabbitmq
5857
description: |-
5958
APIMessageBusInstance is the name of the RabbitMqCluster CR to select
6059
the Message Bus Service instance used by the Nova top level services to
6160
communicate.
61+
Deprecated: Use MessagingBus.Cluster instead
6262
type: string
6363
apiServiceTemplate:
6464
default:
@@ -398,11 +398,11 @@ spec:
398398
Service instance used as the DB of this cell.
399399
type: string
400400
cellMessageBusInstance:
401-
default: rabbitmq
402401
description: |-
403402
CellMessageBusInstance is the name of the RabbitMqCluster CR to select
404403
the Message Bus Service instance used by the nova services to
405404
communicate in this cell. For cell0 it is unused.
405+
Deprecated: Use MessagingBus.Cluster instead
406406
type: string
407407
conductorServiceTemplate:
408408
description: ConductorServiceTemplate - defines the cell conductor
@@ -1342,8 +1342,9 @@ spec:
13421342
cell1:
13431343
cellDatabaseAccount: nova-cell1
13441344
cellDatabaseInstance: openstack-cell1
1345-
cellMessageBusInstance: rabbitmq-cell1
13461345
hasAPIAccess: true
1346+
messagingBus:
1347+
cluster: rabbitmq-cell1
13471348
description: |-
13481349
Cells is a mapping of cell names to NovaCellTemplate objects defining
13491350
the cells in the deployment. The "cell0" cell is a mandatory cell in

api/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.4
55
require (
66
github.com/google/go-cmp v0.7.0
77
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09
8-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260126081203-efc2df9207eb
8+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a
99
github.com/robfig/cron/v3 v3.0.1
1010
k8s.io/api v0.31.14
1111
k8s.io/apimachinery v0.31.14
@@ -39,7 +39,6 @@ require (
3939
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4040
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4141
github.com/onsi/ginkgo/v2 v2.27.5 // indirect
42-
github.com/onsi/gomega v1.39.0 // indirect
4342
github.com/pkg/errors v0.9.1 // indirect
4443
github.com/prometheus/client_golang v1.22.0 // indirect
4544
github.com/prometheus/client_model v0.6.2 // indirect

api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q=
8181
github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
8282
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09 h1:vhAGLKZitJIffj7ONiPpKmOX7Tmt/LGJpaY0Z2LeyfQ=
8383
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=
84+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a h1:97OfmmJgoIKTfbED2SfyjoPkivoiMHg4jfbrTuwSGQw=
85+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a/go.mod h1:ndqfy1KbVorHH6+zlUFPIrCRhMSxO3ImYJUGaooE0x0=
8686
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
8787
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
8888
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

api/v1beta1/nova_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ type NovaSpecCore struct {
4444
APIDatabaseInstance string `json:"apiDatabaseInstance"`
4545

4646
// +kubebuilder:validation:Optional
47-
// +kubebuilder:default=rabbitmq
4847
// APIMessageBusInstance is the name of the RabbitMqCluster CR to select
4948
// the Message Bus Service instance used by the Nova top level services to
5049
// communicate.
51-
APIMessageBusInstance string `json:"apiMessageBusInstance" deprecated:"true" deprecatedNew:"messagingBus.cluster"`
50+
// Deprecated: Use MessagingBus.Cluster instead
51+
APIMessageBusInstance string `json:"apiMessageBusInstance,omitempty"`
5252

5353
// +kubebuilder:validation:Optional
5454
// MessagingBus configuration (username, vhost, and cluster)
5555
MessagingBus rabbitmqv1.RabbitMqConfig `json:"messagingBus,omitempty"`
5656

5757
// +kubebuilder:validation:Optional
58-
// +kubebuilder:default={cell0: {cellDatabaseAccount: nova-cell0, hasAPIAccess: true}, cell1: {cellDatabaseAccount: nova-cell1, cellDatabaseInstance: openstack-cell1, cellMessageBusInstance: rabbitmq-cell1, hasAPIAccess: true}}
58+
// +kubebuilder:default={cell0: {cellDatabaseAccount: nova-cell0, hasAPIAccess: true}, cell1: {cellDatabaseAccount: nova-cell1, cellDatabaseInstance: openstack-cell1, messagingBus: {cluster: rabbitmq-cell1}, hasAPIAccess: true}}
5959
// Cells is a mapping of cell names to NovaCellTemplate objects defining
6060
// the cells in the deployment. The "cell0" cell is a mandatory cell in
6161
// every deployment. Moreover any real deployment needs at least one

api/v1beta1/nova_webhook.go

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"fmt"
2727

2828
"github.com/google/go-cmp/cmp"
29-
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
3029
topologyv1 "github.com/openstack-k8s-operators/infra-operator/apis/topology/v1beta1"
3130
service "github.com/openstack-k8s-operators/lib-common/modules/common/service"
3231
"github.com/robfig/cron/v3"
@@ -89,23 +88,14 @@ func (spec *NovaSpecCore) Default() {
8988
spec.APITimeout = novaDefaults.APITimeout
9089
}
9190

92-
// Default MessagingBus.Cluster from APIMessageBusInstance if not already set
91+
// Default MessagingBus.Cluster if not set
92+
// Migration from deprecated fields is handled by openstack-operator
9393
if spec.MessagingBus.Cluster == "" {
94-
spec.MessagingBus.Cluster = spec.APIMessageBusInstance
94+
spec.MessagingBus.Cluster = "rabbitmq"
9595
}
9696

97-
// Default NotificationsBus if NotificationsBusInstance is specified
98-
if spec.NotificationsBusInstance != nil && *spec.NotificationsBusInstance != "" {
99-
if spec.NotificationsBus == nil {
100-
// Initialize empty NotificationsBus - credentials will be created dynamically
101-
// to ensure separation from MessagingBus (RPC and notifications should never share credentials)
102-
spec.NotificationsBus = &rabbitmqv1.RabbitMqConfig{}
103-
}
104-
// Default cluster name if not already set
105-
if spec.NotificationsBus.Cluster == "" {
106-
spec.NotificationsBus.Cluster = *spec.NotificationsBusInstance
107-
}
108-
}
97+
// NotificationsBus.Cluster is not defaulted - it must be explicitly set if NotificationsBus is configured
98+
// This ensures users make a conscious choice about which cluster to use for notifications
10999

110100
for cellName, cellTemplate := range spec.CellTemplates {
111101

@@ -125,9 +115,14 @@ func (spec *NovaSpecCore) Default() {
125115
}
126116
}
127117

128-
// Default MessagingBus.Cluster from CellMessageBusInstance if not already set
118+
// Default MessagingBus.Cluster if not set
119+
// Migration from deprecated fields is handled by openstack-operator
129120
if cellTemplate.MessagingBus.Cluster == "" {
130-
cellTemplate.MessagingBus.Cluster = cellTemplate.CellMessageBusInstance
121+
if cellName == Cell0Name {
122+
cellTemplate.MessagingBus.Cluster = "rabbitmq"
123+
} else {
124+
cellTemplate.MessagingBus.Cluster = "rabbitmq-" + cellName
125+
}
131126
}
132127

133128
// "cellTemplate" is a by-value copy, so we need to re-inject the updated version of it into the map

api/v1beta1/novacell_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ type NovaCellTemplate struct {
4646
CellDatabaseAccount string `json:"cellDatabaseAccount"`
4747

4848
// +kubebuilder:validation:Optional
49-
// +kubebuilder:default=rabbitmq
5049
// CellMessageBusInstance is the name of the RabbitMqCluster CR to select
5150
// the Message Bus Service instance used by the nova services to
5251
// communicate in this cell. For cell0 it is unused.
53-
CellMessageBusInstance string `json:"cellMessageBusInstance" deprecated:"true" deprecatedNew:"messagingBus.cluster"`
52+
// Deprecated: Use MessagingBus.Cluster instead
53+
CellMessageBusInstance string `json:"cellMessageBusInstance,omitempty"`
5454

5555
// +kubebuilder:validation:Optional
5656
// MessagingBus configuration (username, vhost, and cluster)

config/crd/bases/nova.openstack.org_nova.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ spec:
5454
Service instance used for the Nova API DB.
5555
type: string
5656
apiMessageBusInstance:
57-
default: rabbitmq
5857
description: |-
5958
APIMessageBusInstance is the name of the RabbitMqCluster CR to select
6059
the Message Bus Service instance used by the Nova top level services to
6160
communicate.
61+
Deprecated: Use MessagingBus.Cluster instead
6262
type: string
6363
apiServiceTemplate:
6464
default:
@@ -398,11 +398,11 @@ spec:
398398
Service instance used as the DB of this cell.
399399
type: string
400400
cellMessageBusInstance:
401-
default: rabbitmq
402401
description: |-
403402
CellMessageBusInstance is the name of the RabbitMqCluster CR to select
404403
the Message Bus Service instance used by the nova services to
405404
communicate in this cell. For cell0 it is unused.
405+
Deprecated: Use MessagingBus.Cluster instead
406406
type: string
407407
conductorServiceTemplate:
408408
description: ConductorServiceTemplate - defines the cell conductor
@@ -1342,8 +1342,9 @@ spec:
13421342
cell1:
13431343
cellDatabaseAccount: nova-cell1
13441344
cellDatabaseInstance: openstack-cell1
1345-
cellMessageBusInstance: rabbitmq-cell1
13461345
hasAPIAccess: true
1346+
messagingBus:
1347+
cluster: rabbitmq-cell1
13471348
description: |-
13481349
Cells is a mapping of cell names to NovaCellTemplate objects defining
13491350
the cells in the deployment. The "cell0" cell is a mandatory cell in

config/samples/nova_v1beta1_nova-multi-cell.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ spec:
1010
# This is the name of the single RabbitMqCluster CR we deploy today
1111
# The Service is labelled with
1212
# app.kubernetes.io/component=rabbitmq, app.kubernetes.io/name=<RabbitMqCluster.Name>
13-
apiMessageBusInstance: rabbitmq
13+
messagingBus:
14+
cluster: rabbitmq
1415
# This is the name of the KeystoneAPI CR we deploy today
1516
# The Service is labelled with service=keystone,internal=true
1617
keystoneInstance: keystone
@@ -49,7 +50,8 @@ spec:
4950
cell0:
5051
cellDatabaseInstance: openstack
5152
cellDatabaseAccount: nova-cell0
52-
cellMessageBusInstance: rabbitmq
53+
messagingBus:
54+
cluster: rabbitmq
5355
# cell0 always needs access to the API DB and MQ as it hosts the super
5456
# conductor. It will inherit the API DB and MQ access from the Nova CR
5557
# that creates it.
@@ -63,7 +65,8 @@ spec:
6365
cell1:
6466
cellDatabaseInstance: mariadb-cell1
6567
cellDatabaseAccount: nova-cell1
66-
cellMessageBusInstance: rabbitmq-cell1
68+
messagingBus:
69+
cluster: rabbitmq-cell1
6770
# cell1 will have upcalls support. It will inherit the API DB and MQ
6871
# access from the Nova CR that creates it.
6972
hasAPIAccess: true
@@ -82,7 +85,8 @@ spec:
8285
cell2:
8386
cellDatabaseInstance: mariadb-cell2
8487
cellDatabaseAccount: nova-cell2
85-
cellMessageBusInstance: rabbitmq-cell2
88+
messagingBus:
89+
cluster: rabbitmq-cell2
8690
# cell2 will not get the API DB and MQ connection info from the Nova CR
8791
hasAPIAccess: false
8892
conductorServiceTemplate:

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7
122122
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20260126091827-7758173fbb09/go.mod h1:ZXwFlspJCdZEUjMbmaf61t5AMB4u2vMyAMMoe/vJroE=
123123
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20260126175636-114b4c65a959 h1:8FSpTYAoLq27ElDGe3igPl2QUq9IYD6RJGu2Xu+Ymus=
124124
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20260126175636-114b4c65a959/go.mod h1:pN/s+czXvApiE9nxeTtDeRTXWcaaCLZSrtoyOSUb37k=
125-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a h1:pF3mJ3nwq6r4qwom+rEWZNquZpcQW/iftHlJ1KPIDsk=
126-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a/go.mod h1:kycZyoe7OZdW1HUghr2nI3N7wSJtNahXf6b/ypD14f4=
125+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a h1:97OfmmJgoIKTfbED2SfyjoPkivoiMHg4jfbrTuwSGQw=
126+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20260128142552-e2c25eccae5a/go.mod h1:ndqfy1KbVorHH6+zlUFPIrCRhMSxO3ImYJUGaooE0x0=
127127
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20260128142552-e2c25eccae5a h1:rMrtMsHAfkEqodLUD4Yu5NYtjGW8U3f7zxJTJpwjvPs=
128128
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20260128142552-e2c25eccae5a/go.mod h1:zOX7Y05keiSppIvLabuyh42QHBMhCcoskAtxFRbwXKo=
129129
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251230215914-6ba873b49a35 h1:8WZYfCt1VJHa5sJRX0UhpmoXud/fn8LHQhXsakdYXuQ=
130130
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20251230215914-6ba873b49a35/go.mod h1:H0aQANk8iJPRhS2Bg9n6cYb/IHF0Cks9g7+uZG04Rhk=
131-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20260126081203-efc2df9207eb h1:Fh9yjyogiR9P4oV3a2pSlSUyYzfbWbvlU6RFIjZoxsg=
132-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20260126081203-efc2df9207eb/go.mod h1:sqKTKvYhSzu4Opnjx/J+zzetXKRqYrhxsfvrST/NjoU=
133-
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260124124804-c82210f7a636 h1:Mtjy0cc2pBdyP44/5K6TB/VxIDvtjU2EHer17JKUaLg=
134-
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260124124804-c82210f7a636/go.mod h1:X6W8pIULiWUc6smaTqiNocjxoXaRLgXediwpI/dxD9s=
131+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20260128142552-e2c25eccae5a h1:EIjfIa5m79FIVfEU9zgLJmkMqNN3PhXGKaS6CpaXyfw=
132+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20260128142552-e2c25eccae5a/go.mod h1:sqKTKvYhSzu4Opnjx/J+zzetXKRqYrhxsfvrST/NjoU=
133+
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260120155328-e04f52e73f01 h1:93NxJ/fFx41HcFXk4nJk4PPz4lrqzNMviTmKyWwa+vg=
134+
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20260120155328-e04f52e73f01/go.mod h1:X6W8pIULiWUc6smaTqiNocjxoXaRLgXediwpI/dxD9s=
135135
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec h1:saovr368HPAKHN0aRPh8h8n9s9dn3d8Frmfua0UYRlc=
136136
github.com/openstack-k8s-operators/rabbitmq-cluster-operator/v2 v2.6.1-0.20250929174222-a0d328fa4dec/go.mod h1:Nh2NEePLjovUQof2krTAg4JaAoLacqtPTZQXK6izNfg=
137137
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

test/functional/base_test.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ func NovaSchedulerConditionGetter(name types.NamespacedName) condition.Condition
112112

113113
func GetDefaultNovaSpec() map[string]any {
114114
return map[string]any{
115-
"secret": SecretName,
116-
"cellTemplates": map[string]any{},
117-
"apiMessageBusInstance": cell0.TransportURLName.Name,
118-
"apiDatabaseAccount": novaNames.APIMariaDBDatabaseAccount.Name,
115+
"secret": SecretName,
116+
"cellTemplates": map[string]any{},
117+
"apiDatabaseAccount": novaNames.APIMariaDBDatabaseAccount.Name,
118+
"messagingBus": map[string]any{
119+
"cluster": cell0.TransportURLName.Name,
120+
},
119121
}
120122
}
121123

@@ -161,7 +163,9 @@ func CreateNovaWithCell0(name types.NamespacedName) client.Object {
161163
},
162164
},
163165
},
164-
"apiMessageBusInstance": cell0.TransportURLName.Name,
166+
"messagingBus": map[string]any{
167+
"cluster": cell0.TransportURLName.Name,
168+
},
165169
},
166170
}
167171

@@ -1025,7 +1029,9 @@ func CreateNovaWithNCellsAndEnsureReady(cellNumber int, novaNames *NovaNames) {
10251029
template["cellDatabaseAccount"] = account.Name
10261030
if i != 0 {
10271031
// cell0
1028-
template["cellMessageBusInstance"] = cell.TransportURLName.Name
1032+
template["messagingBus"] = map[string]any{
1033+
"cluster": cell.TransportURLName.Name,
1034+
}
10291035
}
10301036

10311037
if i == 1 {
@@ -1046,7 +1052,9 @@ func CreateNovaWithNCellsAndEnsureReady(cellNumber int, novaNames *NovaNames) {
10461052
spec := GetDefaultNovaSpec()
10471053
spec["cellTemplates"] = cellTemplates
10481054
spec["apiDatabaseInstance"] = novaNames.APIMariaDBDatabaseName.Name
1049-
spec["apiMessageBusInstance"] = novaNames.Cells["cell0"].TransportURLName.Name
1055+
spec["messagingBus"] = map[string]any{
1056+
"cluster": novaNames.Cells["cell0"].TransportURLName.Name,
1057+
}
10501058

10511059
// Deploy Nova and simulate its dependencies
10521060
DeferCleanup(th.DeleteInstance, CreateNova(novaNames.NovaName, spec))

0 commit comments

Comments
 (0)