Skip to content

Commit 2899df6

Browse files
committed
openstackserver: create before delete if adoption fields are empty
1 parent dfb7912 commit 2899df6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

controllers/openstackserver_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ func (r *OpenStackServerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
127127
}()
128128

129129
if !openStackServer.ObjectMeta.DeletionTimestamp.IsZero() {
130+
// When moving a cluster, we need to populate the server status with the resources
131+
// that were in another object's status.
132+
// This is because the status is not persisted across CAPI resources moves.
133+
if openStackServer.Status.Resolved == nil || openStackServer.Status.Resources == nil {
134+
if _, err := r.reconcileNormal(ctx, scope, openStackServer); err != nil {
135+
return ctrl.Result{}, err
136+
}
137+
}
130138
return reconcile.Result{}, r.reconcileDelete(scope, openStackServer)
131139
}
132140

0 commit comments

Comments
 (0)