@@ -65,22 +65,23 @@ func setupSpecNamespace(ctx context.Context, specName string, clusterProxy frame
6565 return namespace , cancelWatches
6666}
6767
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 ) {
6970 Byf ("Dumping logs from the %q workload cluster" , cluster .Name )
7071
71- // Dump all the logs from the workload cluster before deleting them .
72+ // Dump all the logs from the workload cluster.
7273 clusterProxy .CollectWorkloadClusterLogs (ctx , cluster .Namespace , cluster .Name , filepath .Join (artifactFolder , "clusters" , cluster .Name ))
7374
7475 Byf ("Dumping all the Cluster API resources in the %q namespace" , namespace .Name )
7576
76- // Dump all Cluster API related resources to artifacts before deleting them .
77+ // Dump all Cluster API related resources to artifacts.
7778 framework .DumpAllResources (ctx , framework.DumpAllResourcesInput {
7879 Lister : clusterProxy .GetClient (),
7980 Namespace : namespace .Name ,
8081 LogPath : filepath .Join (artifactFolder , "clusters" , clusterProxy .GetName (), "resources" ),
8182 })
8283
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.
8485 if err := clusterProxy .GetClient ().Get (ctx , client .ObjectKeyFromObject (cluster ), & clusterv1.Cluster {}); err == nil {
8586 Byf ("Dumping Pods and Nodes of Cluster %s" , klog .KObj (cluster ))
8687 framework .DumpResourcesForCluster (ctx , framework.DumpResourcesForClusterInput {
@@ -103,6 +104,12 @@ func dumpSpecResourcesAndCleanup(ctx context.Context, specName string, clusterPr
103104 },
104105 })
105106 }
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 )
106113
107114 if ! skipCleanup {
108115 Byf ("Deleting cluster %s" , klog .KObj (cluster ))
0 commit comments