@@ -335,9 +335,8 @@ func addPodInfoToTree(tree treeprint.Tree, info *checkpointInfo) {
335
335
continue
336
336
}
337
337
localTree := annotationTree .AddBranch (key )
338
- for labelKey := range local {
339
- localTree .AddBranch (fmt .Sprintf ("%s: %s" , labelKey , local [labelKey ]))
340
- }
338
+ // Recursively add array/map JSON fields to the tree
339
+ addMapToTree (localTree , local )
341
340
case "io.kubernetes.cri-o.Volumes" :
342
341
// We know that some annotations contain a JSON string we can pretty print
343
342
var local []mountAnnotations
@@ -359,3 +358,37 @@ func addPodInfoToTree(tree treeprint.Tree, info *checkpointInfo) {
359
358
}
360
359
}
361
360
}
361
+
362
+ func addMapToTree (tree treeprint.Tree , data map [string ]interface {}) {
363
+ for key , value := range data {
364
+ switch v := value .(type ) {
365
+ case map [string ]interface {}:
366
+ // Recursively add nested maps
367
+ subTree := tree .AddBranch (fmt .Sprintf ("%s:" , key ))
368
+ addMapToTree (subTree , v )
369
+ case []interface {}:
370
+ // Handle arrays recursively
371
+ arrayTree := tree .AddBranch (fmt .Sprintf ("%s: " , key ))
372
+ addArrayToTree (arrayTree , v )
373
+ default :
374
+ tree .AddBranch (fmt .Sprintf ("%s: %v" , key , v ))
375
+ }
376
+ }
377
+ }
378
+
379
+ func addArrayToTree (tree treeprint.Tree , data []interface {}) {
380
+ for i , value := range data {
381
+ switch v := value .(type ) {
382
+ case map [string ]interface {}:
383
+ // Recursively add maps inside arrays
384
+ subTree := tree .AddBranch (fmt .Sprintf ("[%d]:" , i ))
385
+ addMapToTree (subTree , v )
386
+ case []interface {}:
387
+ // Recursively add arrays inside arrays
388
+ subArrayTree := tree .AddBranch (fmt .Sprintf ("[%d]: " , i ))
389
+ addArrayToTree (subArrayTree , v )
390
+ default :
391
+ tree .AddBranch (fmt .Sprintf ("[%d]: %v" , i , v ))
392
+ }
393
+ }
394
+ }
0 commit comments