Skip to content

Commit

Permalink
[PWX-27765] Fix migration status update issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pure-jliao authored and jrivera-px committed Apr 27, 2023
1 parent e1fc287 commit 683cc7c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pkg/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ func (h *Handler) processMigration(

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

// Mark migration as completed in the cluster condition list
updatedCluster = &corev1.StorageCluster{}
if err := h.client.Get(context.TODO(), types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, updatedCluster); err != nil {
return err
}
util.UpdateStorageClusterCondition(updatedCluster, &corev1.ClusterCondition{
Source: pxutil.PortworxComponentName,
Type: corev1.ClusterConditionTypeMigration,
Status: corev1.ClusterConditionStatusCompleted,
})
if err := k8sutil.UpdateStorageClusterStatus(h.client, updatedCluster); err != nil {
return err
}

// TODO: once daemonset is deleted, if we restart operator all code after this line
// will not be re-executed, so we should delete daemonset after everything is finished.
logrus.Infof("Deleting portworx DaemonSet")
Expand All @@ -238,16 +252,6 @@ func (h *Handler) processMigration(
// this cluster is a result of migration. After we have added that we can remove the
// migration-approved annotation after a successful migration.

// Mark migration as completed in the cluster condition list
util.UpdateStorageClusterCondition(updatedCluster, &corev1.ClusterCondition{
Source: pxutil.PortworxComponentName,
Type: corev1.ClusterConditionTypeMigration,
Status: corev1.ClusterConditionStatusCompleted,
})
if err := k8sutil.UpdateStorageClusterStatus(h.client, updatedCluster); err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 683cc7c

Please sign in to comment.