Skip to content

Commit 7941f38

Browse files
committed
[PWX-27765] Fix migration status update issue
1 parent 7ced5ec commit 7941f38

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

pkg/migration/migration.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,20 @@ func (h *Handler) processMigration(
220220

221221
// TODO: Wait for all components to be up, before marking the migration as completed
222222

223+
// Mark migration as completed in the cluster condition list
224+
updatedCluster = &corev1.StorageCluster{}
225+
if err := h.client.Get(context.TODO(), types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, updatedCluster); err != nil {
226+
return err
227+
}
228+
util.UpdateStorageClusterCondition(updatedCluster, &corev1.ClusterCondition{
229+
Source: pxutil.PortworxComponentName,
230+
Type: corev1.ClusterConditionTypeMigration,
231+
Status: corev1.ClusterConditionStatusCompleted,
232+
})
233+
if err := k8sutil.UpdateStorageClusterStatus(h.client, updatedCluster); err != nil {
234+
return err
235+
}
236+
223237
// TODO: once daemonset is deleted, if we restart operator all code after this line
224238
// will not be re-executed, so we should delete daemonset after everything is finished.
225239
logrus.Infof("Deleting portworx DaemonSet")
@@ -238,16 +252,6 @@ func (h *Handler) processMigration(
238252
// this cluster is a result of migration. After we have added that we can remove the
239253
// migration-approved annotation after a successful migration.
240254

241-
// Mark migration as completed in the cluster condition list
242-
util.UpdateStorageClusterCondition(updatedCluster, &corev1.ClusterCondition{
243-
Source: pxutil.PortworxComponentName,
244-
Type: corev1.ClusterConditionTypeMigration,
245-
Status: corev1.ClusterConditionStatusCompleted,
246-
})
247-
if err := k8sutil.UpdateStorageClusterStatus(h.client, updatedCluster); err != nil {
248-
return err
249-
}
250-
251255
return nil
252256
}
253257

0 commit comments

Comments
 (0)