Set the resource migration finish timestamp once pruning is done
@@ -1021,15 +1021,6 @@ func (m *MigrationController) migrateResources(migration *stork_api.Migration, v
return err
}
- migration.Status.ResourceMigrationFinishTimestamp = metav1.Now()
- migration.Status.Stage = stork_api.MigrationStageFinal
- migration.Status.Status = stork_api.MigrationStatusSuccessful
- for _, resource := range migration.Status.Resources {
- if resource.Status != stork_api.MigrationStatusSuccessful {
- migration.Status.Status = stork_api.MigrationStatusPartialSuccess
- break
- }
- }
if *migration.Spec.PurgeDeletedResources {
if err := m.purgeMigratedResources(migration, resourceCollectorOpts); err != nil {
message := fmt.Sprintf("Error cleaning up resources: %v", err)
@@ -1042,6 +1033,16 @@ func (m *MigrationController) migrateResources(migration *stork_api.Migration, v
}
}
+ migration.Status.ResourceMigrationFinishTimestamp = metav1.Now()
+ migration.Status.Stage = stork_api.MigrationStageFinal
+ migration.Status.Status = stork_api.MigrationStatusSuccessful
+ for _, resource := range migration.Status.Resources {
+ if resource.Status != stork_api.MigrationStatusSuccessful {
+ migration.Status.Status = stork_api.MigrationStatusPartialSuccess
+ break
+ }
+ }
+
migration.Status.FinishTimestamp = metav1.Now()
err = m.updateMigrationCR(context.TODO(), migration)
if err != nil {
@@ -1572,11 +1573,11 @@ func (m *MigrationController) applyResources(
res.ResourceVersion = ""
// if crds is applied as v1beta on k8s version 1.16+ it will have
- // preservedUnkownField set and api version converted to v1 ,
+ // preservedUnknownField set and api version converted to v1 ,
// which cause issue while applying it on dest cluster,
// since we will be applying v1 crds with non-valid schema
- // this converts `preserveUnknownFiels`(deprecated) to spec.Versions[*].xPreservedUnknown
+ // this converts `preserveUnknownFields`(deprecated) to spec.Versions[*].xPreservedUnknown
// equivalent
var updatedVersions []apiextensionsv1.CustomResourceDefinitionVersion
if res.Spec.PreserveUnknownFields {
