Skip to content

Commit 0cc24a2

Browse files
committed
remove leftover webhooks defaulting
1 parent 9b6de6d commit 0cc24a2

1 file changed

Lines changed: 37 additions & 65 deletions

File tree

api/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,10 @@ func (r *OpenStackControlPlane) DefaultServices() {
885885
if r.Spec.Cinder.Template == nil {
886886
r.Spec.Cinder.Template = &cinderv1.CinderSpecCore{}
887887
}
888-
// Set default RabbitMQ cluster for messaging if not specified
889-
if r.Spec.Cinder.Template.MessagingBus.Cluster == "" {
890-
r.Spec.Cinder.Template.MessagingBus.Cluster = "rabbitmq"
891-
}
892-
// NotificationsBus propagation is handled in the reconcile loop to properly support
893-
// both inheritance and clearing. The webhook doesn't have access to the old object
894-
// to distinguish between user overrides and inherited values.
888+
// MessagingBus and NotificationsBus defaults are handled in the reconcile loop
889+
// to properly support migration from deprecated fields and inheritance.
890+
// The webhook doesn't have access to the old object to distinguish between
891+
// user overrides and inherited values.
895892
r.Spec.Cinder.Template.Default()
896893
initializeOverrideSpec(&r.Spec.Cinder.APIOverride.Route, true)
897894
r.Spec.Cinder.Template.SetDefaultRouteAnnotations(r.Spec.Cinder.APIOverride.Route.Annotations)
@@ -971,10 +968,9 @@ func (r *OpenStackControlPlane) DefaultServices() {
971968
if r.Spec.Ironic.Template.StorageClass == "" {
972969
r.Spec.Ironic.Template.StorageClass = r.Spec.StorageClass
973970
}
974-
// Set default RabbitMQ cluster for messaging if not specified
975-
if r.Spec.Ironic.Template.MessagingBus.Cluster == "" {
976-
r.Spec.Ironic.Template.MessagingBus.Cluster = "rabbitmq"
977-
}
971+
// MessagingBus defaults are handled in the reconcile loop to properly support
972+
// migration from deprecated fields. The webhook doesn't have access to the old
973+
// object to distinguish between user overrides and inherited values.
978974
r.Spec.Ironic.Template.Default()
979975

980976
initializeOverrideSpec(&r.Spec.Ironic.APIOverride.Route, true)
@@ -1001,13 +997,10 @@ func (r *OpenStackControlPlane) DefaultServices() {
1001997
if r.Spec.Manila.Template == nil {
1002998
r.Spec.Manila.Template = &manilav1.ManilaSpecCore{}
1003999
}
1004-
// Set default RabbitMQ cluster for messaging if not specified
1005-
if r.Spec.Manila.Template.MessagingBus.Cluster == "" {
1006-
r.Spec.Manila.Template.MessagingBus.Cluster = "rabbitmq"
1007-
}
1008-
// NotificationsBus propagation is handled in the reconcile loop to properly support
1009-
// both inheritance and clearing. The webhook doesn't have access to the old object
1010-
// to distinguish between user overrides and inherited values.
1000+
// MessagingBus and NotificationsBus defaults are handled in the reconcile loop
1001+
// to properly support migration from deprecated fields and inheritance.
1002+
// The webhook doesn't have access to the old object to distinguish between
1003+
// user overrides and inherited values.
10111004
r.Spec.Manila.Template.Default()
10121005
initializeOverrideSpec(&r.Spec.Manila.APIOverride.Route, true)
10131006
r.Spec.Manila.Template.SetDefaultRouteAnnotations(r.Spec.Manila.APIOverride.Route.Annotations)
@@ -1031,13 +1024,10 @@ func (r *OpenStackControlPlane) DefaultServices() {
10311024
if r.Spec.Neutron.Template == nil {
10321025
r.Spec.Neutron.Template = &neutronv1.NeutronAPISpecCore{}
10331026
}
1034-
// Set default RabbitMQ cluster for messaging if not specified
1035-
if r.Spec.Neutron.Template.MessagingBus.Cluster == "" {
1036-
r.Spec.Neutron.Template.MessagingBus.Cluster = "rabbitmq"
1037-
}
1038-
// NotificationsBus propagation is handled in the reconcile loop to properly support
1039-
// both inheritance and clearing. The webhook doesn't have access to the old object
1040-
// to distinguish between user overrides and inherited values.
1027+
// MessagingBus and NotificationsBus defaults are handled in the reconcile loop
1028+
// to properly support migration from deprecated fields and inheritance.
1029+
// The webhook doesn't have access to the old object to distinguish between
1030+
// user overrides and inherited values.
10411031
r.Spec.Neutron.Template.Default()
10421032
initializeOverrideSpec(&r.Spec.Neutron.APIOverride.Route, true)
10431033
r.Spec.Neutron.Template.SetDefaultRouteAnnotations(r.Spec.Neutron.APIOverride.Route.Annotations)
@@ -1048,23 +1038,11 @@ func (r *OpenStackControlPlane) DefaultServices() {
10481038
if r.Spec.Nova.Template == nil {
10491039
r.Spec.Nova.Template = &novav1.NovaSpecCore{}
10501040
}
1051-
// Nova uses MessagingBus directly without a deprecated field
1052-
// Set default cluster if not specified
1053-
if r.Spec.Nova.Template.MessagingBus.Cluster == "" {
1054-
r.Spec.Nova.Template.MessagingBus.Cluster = "rabbitmq"
1055-
}
1056-
// Set default MessagingBus.Cluster for each cell if not specified
1057-
if r.Spec.Nova.Template.CellTemplates != nil {
1058-
for cellName, cellTemplate := range r.Spec.Nova.Template.CellTemplates {
1059-
if cellTemplate.MessagingBus.Cluster == "" {
1060-
cellTemplate.MessagingBus.Cluster = "rabbitmq"
1061-
r.Spec.Nova.Template.CellTemplates[cellName] = cellTemplate
1062-
}
1063-
}
1064-
}
1065-
// NotificationsBus propagation is handled in the reconcile loop to properly support
1066-
// both inheritance and clearing. The webhook doesn't have access to the old object
1067-
// to distinguish between user overrides and inherited values.
1041+
// MessagingBus and NotificationsBus defaults (including per-cell MessagingBus)
1042+
// are handled in the reconcile loop to properly support migration from
1043+
// deprecated fields (APIMessageBusInstance and CellMessageBusInstance).
1044+
// The webhook doesn't have access to the old object to distinguish between
1045+
// user overrides and inherited values.
10681046
r.Spec.Nova.Template.Default()
10691047
initializeOverrideSpec(&r.Spec.Nova.APIOverride.Route, true)
10701048
r.Spec.Nova.Template.SetDefaultRouteAnnotations(r.Spec.Nova.APIOverride.Route.Annotations)
@@ -1120,10 +1098,10 @@ func (r *OpenStackControlPlane) DefaultServices() {
11201098
if r.Spec.Heat.Template == nil {
11211099
r.Spec.Heat.Template = &heatv1.HeatSpecCore{}
11221100
}
1123-
// Set default RabbitMQ cluster for messaging if not specified
1124-
if r.Spec.Heat.Template.MessagingBus.Cluster == "" {
1125-
r.Spec.Heat.Template.MessagingBus.Cluster = "rabbitmq"
1126-
}
1101+
// MessagingBus and NotificationsBus defaults are handled in the reconcile loop
1102+
// to properly support migration from deprecated fields and inheritance.
1103+
// The webhook doesn't have access to the old object to distinguish between
1104+
// user overrides and inherited values.
11271105
r.Spec.Heat.Template.Default()
11281106
initializeOverrideSpec(&r.Spec.Heat.APIOverride.Route, true)
11291107
r.Spec.Heat.Template.SetDefaultRouteAnnotations(r.Spec.Heat.APIOverride.Route.Annotations)
@@ -1159,10 +1137,9 @@ func (r *OpenStackControlPlane) DefaultServices() {
11591137
r.Spec.Octavia.Template = &octaviav1.OctaviaSpecCore{}
11601138
}
11611139

1162-
// Set default RabbitMQ cluster for messaging if not specified
1163-
if r.Spec.Octavia.Template.MessagingBus.Cluster == "" {
1164-
r.Spec.Octavia.Template.MessagingBus.Cluster = "rabbitmq"
1165-
}
1140+
// MessagingBus defaults are handled in the reconcile loop to properly support
1141+
// migration from deprecated fields. The webhook doesn't have access to the old
1142+
// object to distinguish between user overrides and inherited values.
11661143
r.Spec.Octavia.Template.Default()
11671144
initializeOverrideSpec(&r.Spec.Octavia.APIOverride.Route, true)
11681145
r.Spec.Octavia.Template.SetDefaultRouteAnnotations(r.Spec.Octavia.APIOverride.Route.Annotations)
@@ -1173,10 +1150,9 @@ func (r *OpenStackControlPlane) DefaultServices() {
11731150
if r.Spec.Barbican.Template == nil {
11741151
r.Spec.Barbican.Template = &barbicanv1.BarbicanSpecCore{}
11751152
}
1176-
// Set default RabbitMQ cluster for messaging if not specified
1177-
if r.Spec.Barbican.Template.MessagingBus.Cluster == "" {
1178-
r.Spec.Barbican.Template.MessagingBus.Cluster = "rabbitmq"
1179-
}
1153+
// MessagingBus defaults are handled in the reconcile loop to properly support
1154+
// migration from deprecated fields. The webhook doesn't have access to the old
1155+
// object to distinguish between user overrides and inherited values.
11801156
r.Spec.Barbican.Template.Default()
11811157
initializeOverrideSpec(&r.Spec.Barbican.APIOverride.Route, true)
11821158
r.Spec.Barbican.Template.SetDefaultRouteAnnotations(r.Spec.Barbican.APIOverride.Route.Annotations)
@@ -1187,10 +1163,9 @@ func (r *OpenStackControlPlane) DefaultServices() {
11871163
if r.Spec.Designate.Template == nil {
11881164
r.Spec.Designate.Template = &designatev1.DesignateSpecCore{}
11891165
}
1190-
// Set default RabbitMQ cluster for messaging if not specified
1191-
if r.Spec.Designate.Template.MessagingBus.Cluster == "" {
1192-
r.Spec.Designate.Template.MessagingBus.Cluster = "rabbitmq"
1193-
}
1166+
// MessagingBus defaults are handled in the reconcile loop to properly support
1167+
// migration from deprecated fields. The webhook doesn't have access to the old
1168+
// object to distinguish between user overrides and inherited values.
11941169
r.Spec.Designate.Template.Default()
11951170
}
11961171

@@ -1212,13 +1187,10 @@ func (r *OpenStackControlPlane) DefaultServices() {
12121187
if r.Spec.Watcher.Template == nil {
12131188
r.Spec.Watcher.Template = &watcherv1.WatcherSpecCore{}
12141189
}
1215-
// Set default RabbitMQ cluster for messaging if not specified
1216-
if r.Spec.Watcher.Template.MessagingBus.Cluster == "" {
1217-
r.Spec.Watcher.Template.MessagingBus.Cluster = "rabbitmq"
1218-
}
1219-
// NotificationsBus propagation is handled in the reconcile loop to properly support
1220-
// both inheritance and clearing. The webhook doesn't have access to the old object
1221-
// to distinguish between user overrides and inherited values.
1190+
// MessagingBus and NotificationsBus defaults are handled in the reconcile loop
1191+
// to properly support migration from deprecated fields and inheritance.
1192+
// The webhook doesn't have access to the old object to distinguish between
1193+
// user overrides and inherited values.
12221194
r.Spec.Watcher.Template.Default()
12231195

12241196
if r.Spec.Watcher.Enabled {

0 commit comments

Comments
 (0)