@@ -65,22 +65,23 @@ func setupSpecNamespace(ctx context.Context, specName string, clusterProxy frame
65
65
return namespace , cancelWatches
66
66
}
67
67
68
- func dumpSpecResourcesAndCleanup (ctx context.Context , specName string , clusterProxy framework.ClusterProxy , artifactFolder string , namespace * corev1.Namespace , cancelWatches context.CancelFunc , cluster * clusterv1.Cluster , intervalsGetter func (spec , key string ) []interface {}, skipCleanup bool ) {
68
+ // dumpAllResources dumps all the resources in the spec namespace and the workload cluster.
69
+ func dumpAllResources (ctx context.Context , clusterProxy framework.ClusterProxy , artifactFolder string , namespace * corev1.Namespace , cluster * clusterv1.Cluster ) {
69
70
Byf ("Dumping logs from the %q workload cluster" , cluster .Name )
70
71
71
- // Dump all the logs from the workload cluster before deleting them .
72
+ // Dump all the logs from the workload cluster.
72
73
clusterProxy .CollectWorkloadClusterLogs (ctx , cluster .Namespace , cluster .Name , filepath .Join (artifactFolder , "clusters" , cluster .Name ))
73
74
74
75
Byf ("Dumping all the Cluster API resources in the %q namespace" , namespace .Name )
75
76
76
- // Dump all Cluster API related resources to artifacts before deleting them .
77
+ // Dump all Cluster API related resources to artifacts.
77
78
framework .DumpAllResources (ctx , framework.DumpAllResourcesInput {
78
79
Lister : clusterProxy .GetClient (),
79
80
Namespace : namespace .Name ,
80
81
LogPath : filepath .Join (artifactFolder , "clusters" , clusterProxy .GetName (), "resources" ),
81
82
})
82
83
83
- // If the cluster still exists, dump pods and nodes of the workload cluster before deleting the cluster .
84
+ // If the cluster still exists, dump pods and nodes of the workload cluster.
84
85
if err := clusterProxy .GetClient ().Get (ctx , client .ObjectKeyFromObject (cluster ), & clusterv1.Cluster {}); err == nil {
85
86
Byf ("Dumping Pods and Nodes of Cluster %s" , klog .KObj (cluster ))
86
87
framework .DumpResourcesForCluster (ctx , framework.DumpResourcesForClusterInput {
@@ -103,6 +104,12 @@ func dumpSpecResourcesAndCleanup(ctx context.Context, specName string, clusterPr
103
104
},
104
105
})
105
106
}
107
+ }
108
+
109
+ // dumpSpecResourcesAndCleanup dumps all the resources in the spec namespace and cleans up the spec namespace.
110
+ func dumpSpecResourcesAndCleanup (ctx context.Context , specName string , clusterProxy framework.ClusterProxy , artifactFolder string , namespace * corev1.Namespace , cancelWatches context.CancelFunc , cluster * clusterv1.Cluster , intervalsGetter func (spec , key string ) []interface {}, skipCleanup bool ) {
111
+ // Dump all the resources in the spec namespace and the workload cluster.
112
+ dumpAllResources (ctx , clusterProxy , artifactFolder , namespace , cluster )
106
113
107
114
if ! skipCleanup {
108
115
Byf ("Deleting cluster %s" , klog .KObj (cluster ))
0 commit comments