@@ -65,29 +65,29 @@ func (o *objectMover) Move(namespace string, toCluster Client, dryRun bool) erro
65
65
// checks that all the required providers in place in the target cluster.
66
66
if ! o .dryRun {
67
67
if err := o .checkTargetProviders (toCluster .ProviderInventory ()); err != nil {
68
- return err
68
+ return errors . Wrap ( err , "failed to check providers in target cluster" )
69
69
}
70
70
}
71
71
72
72
// Gets all the types defines by the CRDs installed by clusterctl plus the ConfigMap/Secret core types.
73
73
err := objectGraph .getDiscoveryTypes ()
74
74
if err != nil {
75
- return err
75
+ return errors . Wrap ( err , "failed to retrieve discovery types" )
76
76
}
77
77
78
78
// Discovery the object graph for the selected types:
79
79
// - Nodes are defined the Kubernetes objects (Clusters, Machines etc.) identified during the discovery process.
80
80
// - Edges are derived by the OwnerReferences between nodes.
81
81
if err := objectGraph .Discovery (namespace ); err != nil {
82
- return err
82
+ return errors . Wrap ( err , "failed to discover the object graph" )
83
83
}
84
84
85
85
// Checks if Cluster API has already completed the provisioning of the infrastructure for the objects involved in the move operation.
86
86
// This is required because if the infrastructure is provisioned, then we can reasonably assume that the objects we are moving are
87
87
// not currently waiting for long-running reconciliation loops, and so we can safely rely on the pause field on the Cluster object
88
88
// for blocking any further object reconciliation on the source objects.
89
89
if err := o .checkProvisioningCompleted (objectGraph ); err != nil {
90
- return err
90
+ return errors . Wrap ( err , "failed to check for provisioned infrastructure" )
91
91
}
92
92
93
93
// Check whether nodes are not included in GVK considered for move
@@ -178,8 +178,8 @@ func getClusterObj(proxy Proxy, cluster *node, clusterObj *clusterv1.Cluster) er
178
178
}
179
179
180
180
if err := c .Get (ctx , clusterObjKey , clusterObj ); err != nil {
181
- return errors .Wrapf (err , "error reading %q %s/%s" ,
182
- clusterObj .GroupVersionKind (), clusterObj . GetNamespace (), clusterObj .GetName ())
181
+ return errors .Wrapf (err , "error reading Cluster %s/%s" ,
182
+ clusterObj .GetNamespace (), clusterObj .GetName ())
183
183
}
184
184
return nil
185
185
}
@@ -196,8 +196,8 @@ func getMachineObj(proxy Proxy, machine *node, machineObj *clusterv1.Machine) er
196
196
}
197
197
198
198
if err := c .Get (ctx , machineObjKey , machineObj ); err != nil {
199
- return errors .Wrapf (err , "error reading %q %s/%s" ,
200
- machineObj .GroupVersionKind (), machineObj . GetNamespace (), machineObj .GetName ())
199
+ return errors .Wrapf (err , "error reading Machine %s/%s" ,
200
+ machineObj .GetNamespace (), machineObj .GetName ())
201
201
}
202
202
return nil
203
203
}
@@ -362,13 +362,13 @@ func patchCluster(proxy Proxy, cluster *node, patch client.Patch) error {
362
362
}
363
363
364
364
if err := cFrom .Get (ctx , clusterObjKey , clusterObj ); err != nil {
365
- return errors .Wrapf (err , "error reading %q %s/%s" ,
366
- clusterObj .GroupVersionKind (), clusterObj . GetNamespace (), clusterObj .GetName ())
365
+ return errors .Wrapf (err , "error reading Cluster %s/%s" ,
366
+ clusterObj .GetNamespace (), clusterObj .GetName ())
367
367
}
368
368
369
369
if err := cFrom .Patch (ctx , clusterObj , patch ); err != nil {
370
- return errors .Wrapf (err , "error patching %q %s/%s" ,
371
- clusterObj .GroupVersionKind (), clusterObj . GetNamespace (), clusterObj .GetName ())
370
+ return errors .Wrapf (err , "error patching Cluster %s/%s" ,
371
+ clusterObj .GetNamespace (), clusterObj .GetName ())
372
372
}
373
373
374
374
return nil
0 commit comments