Skip to content

Commit 11eb408

Browse files
committed
Make deprecated parameter optional
1 parent 42392ec commit 11eb408

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎api/bases/keystone.openstack.org_keystoneapis.yaml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,10 +1479,10 @@ spec:
14791479
e.g. to check logs
14801480
type: boolean
14811481
rabbitMqClusterName:
1482-
default: rabbitmq
14831482
description: |-
14841483
RabbitMQ instance name
14851484
Needed to request a transportURL that is created and used in Keystone
1485+
Deprecated: Use NotificationsBus.Cluster instead
14861486
type: string
14871487
region:
14881488
default: regionOne
@@ -1625,7 +1625,6 @@ spec:
16251625
- containerImage
16261626
- databaseInstance
16271627
- memcachedInstance
1628-
- rabbitMqClusterName
16291628
- secret
16301629
type: object
16311630
status:

‎api/v1beta1/keystoneapi_types.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ type KeystoneAPISpecCore struct {
184184
// Override, provides the ability to override the generated manifest of several child resources.
185185
Override APIOverrideSpec `json:"override,omitempty"`
186186

187-
// +kubebuilder:validation:Required
188-
// +kubebuilder:default=rabbitmq
187+
// +kubebuilder:validation:Optional
189188
// RabbitMQ instance name
190189
// Needed to request a transportURL that is created and used in Keystone
191-
RabbitMqClusterName string `json:"rabbitMqClusterName"`
190+
// Deprecated: Use NotificationsBus.Cluster instead
191+
RabbitMqClusterName string `json:"rabbitMqClusterName,omitempty"`
192192

193193
// +kubebuilder:validation:Optional
194194
// +operator-sdk:csv:customresourcedefinitions:type=spec

‎api/v1beta1/keystoneapi_webhook.go‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"fmt"
2727
"net/url"
2828

29-
rabbitmqv1 "github.com/openstack-k8s-operators/infra-operator/apis/rabbitmq/v1beta1"
3029
"github.com/openstack-k8s-operators/lib-common/modules/common/service"
3130
apierrors "k8s.io/apimachinery/pkg/api/errors"
3231
"k8s.io/apimachinery/pkg/runtime"
@@ -79,12 +78,15 @@ func (spec *KeystoneAPISpecCore) Default() {
7978
if spec.APITimeout == 0 {
8079
spec.APITimeout = keystoneAPIDefaults.APITimeout
8180
}
82-
// Default NotificationsBus if RabbitMqClusterName is specified
83-
if spec.RabbitMqClusterName != "" {
84-
if spec.NotificationsBus == nil {
85-
spec.NotificationsBus = &rabbitmqv1.RabbitMqConfig{}
81+
// Default NotificationsBus cluster if specified
82+
if spec.NotificationsBus != nil && spec.NotificationsBus.Cluster == "" {
83+
if spec.RabbitMqClusterName != "" {
84+
// Migrate from deprecated field
85+
spec.NotificationsBus.Cluster = spec.RabbitMqClusterName
86+
} else {
87+
// Set default value
88+
spec.NotificationsBus.Cluster = "rabbitmq"
8689
}
87-
rabbitmqv1.DefaultRabbitMqConfig(spec.NotificationsBus, spec.RabbitMqClusterName)
8890
}
8991
}
9092

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,10 +1479,10 @@ spec:
14791479
e.g. to check logs
14801480
type: boolean
14811481
rabbitMqClusterName:
1482-
default: rabbitmq
14831482
description: |-
14841483
RabbitMQ instance name
14851484
Needed to request a transportURL that is created and used in Keystone
1485+
Deprecated: Use NotificationsBus.Cluster instead
14861486
type: string
14871487
region:
14881488
default: regionOne
@@ -1625,7 +1625,6 @@ spec:
16251625
- containerImage
16261626
- databaseInstance
16271627
- memcachedInstance
1628-
- rabbitMqClusterName
16291628
- secret
16301629
type: object
16311630
status:

0 commit comments

Comments
 (0)