@@ -202,6 +202,21 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) {
202202 return input .TargetCluster .GetClient ().Get (ctx , client.ObjectKey {Name : "kube-system" }, kubeSystem )
203203 }, "5s" , "100ms" ).Should (Succeed (), "Failed to assert target API server stability" )
204204
205+ Logf ("Dump the target cluster resources before pivoting" )
206+ framework .DumpAllResources (ctx , framework.DumpAllResourcesInput {
207+ Lister : input .TargetCluster .GetClient (),
208+ Namespace : input .Namespace ,
209+ LogPath : filepath .Join (input .ArtifactFolder , "clusters" , "target-cluster-before-pivot" , "resources" ),
210+ KubeConfigPath : input .TargetCluster .GetKubeconfigPath (),
211+ ClusterctlConfigPath : input .ClusterctlConfigPath ,
212+ })
213+
214+ By ("Fetch logs from target cluster before pivoting" )
215+ err = FetchClusterLogs (input .TargetCluster , filepath .Join (input .ArtifactFolder , "clusters" , "target-cluster-before-pivot" , "resources" ))
216+ if err != nil {
217+ Logf ("Error: %v" , err )
218+ }
219+
205220 By ("Moving the cluster to self hosted" )
206221 clusterctl .Move (ctx , clusterctl.MoveInput {
207222 LogFolder : filepath .Join (input .ArtifactFolder , "clusters" , input .ClusterName + "-bootstrap" ),
@@ -212,6 +227,21 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) {
212227 })
213228 LogFromFile (filepath .Join (input .ArtifactFolder , "clusters" , input .ClusterName + "-bootstrap" , "logs" , input .Namespace , "clusterctl-move.log" ))
214229
230+ By ("Fetch logs from target cluster after pivoting" )
231+ err = FetchClusterLogs (input .TargetCluster , filepath .Join (input .ArtifactFolder , "clusters" , "target-cluster-after-pivot" , "resources" ))
232+ if err != nil {
233+ Logf ("Error: %v" , err )
234+ }
235+
236+ Logf ("Dump the target cluster resources after pivoting" )
237+ framework .DumpAllResources (ctx , framework.DumpAllResourcesInput {
238+ Lister : input .TargetCluster .GetClient (),
239+ Namespace : input .Namespace ,
240+ LogPath : filepath .Join (input .ArtifactFolder , "clusters" , "target-cluster-after-pivot" , "resources" ),
241+ KubeConfigPath : input .TargetCluster .GetKubeconfigPath (),
242+ ClusterctlConfigPath : input .ClusterctlConfigPath ,
243+ })
244+
215245 By ("Remove BMO deployment from the source cluster" )
216246 RemoveDeployment (ctx , func () RemoveDeploymentInput {
217247 return RemoveDeploymentInput {
@@ -220,6 +250,7 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) {
220250 Name : input .E2EConfig .MustGetVariable (NamePrefix ) + "-controller-manager" ,
221251 }
222252 })
253+
223254 pivotingCluster := framework .DiscoveryAndWaitForCluster (ctx , framework.DiscoveryAndWaitForClusterInput {
224255 Getter : input .TargetCluster .GetClient (),
225256 Namespace : input .Namespace ,
@@ -334,7 +365,6 @@ func RemoveDeployment(ctx context.Context, inputGetter func() RemoveDeploymentIn
334365func labelBMOCRDs (ctx context.Context , targetCluster framework.ClusterProxy ) {
335366 labels := map [string ]string {}
336367 labels [clusterctlv1 .ClusterctlLabel ] = ""
337- labels [clusterctlv1 .ClusterctlMoveLabel ] = ""
338368 labels [clusterctlv1 .ClusterctlMoveHierarchyLabel ] = ""
339369 labels [clusterv1 .ProviderNameLabel ] = "metal3"
340370 crdName := "baremetalhosts.metal3.io"
@@ -345,7 +375,8 @@ func labelBMOCRDs(ctx context.Context, targetCluster framework.ClusterProxy) {
345375func labelHDCRDs (ctx context.Context , targetCluster framework.ClusterProxy ) {
346376 labels := map [string ]string {}
347377 labels [clusterctlv1 .ClusterctlLabel ] = ""
348- labels [clusterctlv1 .ClusterctlMoveLabel ] = ""
378+ labels [clusterctlv1 .ClusterctlMoveHierarchyLabel ] = ""
379+ labels [clusterv1 .ProviderNameLabel ] = "metal3"
349380 crdName := "hardwaredata.metal3.io"
350381 err := LabelCRD (ctx , targetCluster .GetClient (), crdName , labels )
351382 Expect (err ).ToNot (HaveOccurred (), "Cannot label HD CRDs" )
0 commit comments