-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursively add metadata JSON fields to the tree #149
Recursively add metadata JSON fields to the tree #149
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
==========================================
- Coverage 77.76% 76.42% -1.35%
==========================================
Files 11 11
Lines 1417 1442 +25
==========================================
Hits 1102 1102
- Misses 241 266 +25
Partials 74 74 ☔ View full report in Codecov by Sentry. |
Nice, I was also thinking about something like that. I am not sure about:
That look a bit strange. Could this just be left away? Or why do you print it? Any special reason it might be useful? |
+1, I think we can just leave the braces out, similar to |
Some annotations contain a JSON string. This string may include nested arrays and maps. This patch updates addPodInfoToTree() to recursively add these fields to the output tree using pretty print. Before: ├── kubectl.kubernetes.io/last-applied-configuration │ ├── metadata: map[annotations:map[] name:counter-pod namespace:default] │ ├── spec: map[containers:[map[args:[-c i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done] command:[sh] image:busybox:latest name:counter-container]]] After: ├── kubectl.kubernetes.io/last-applied-configuration │ ├── apiVersion: v1 │ ├── kind: Pod │ ├── metadata: │ │ ├── annotations: │ │ ├── name: counter-pod │ │ └── namespace: default │ └── spec: │ └── containers: │ └── [0]: │ ├── args: │ │ ├── [0]: -c │ │ └── [1]: i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done │ ├── command: │ │ └── [0]: sh │ ├── image: busybox:latest │ └── name: counter-container Signed-off-by: Radostin Stoyanov <[email protected]>
6632ed1
to
2e305b9
Compare
Thanks, I've updated the pull request to remove the brackets in the output. |
Some annotations contain a JSON string, and this string may include nested arrays and maps. This pull request updates
addPodInfoToTree()
to recursively add these fields to the output tree using pretty print.Before:
After: