|
|
|
|
|
by rmetzler
1935 days ago
|
|
It's neat that you built what you needed in a few lines of code. I must say, I don't quite like the output of Graphtage, I like your's a little bit more, but without a context it's not easy to see how podIP is nested. Usecases might be a little bit different, but please allow me to share my solution. The problem with diffing JSON and yaml is, that these formats aren't line based and hashes don't need to be ordered. But there is gron to turn json into a greppable line-based format [1]. Then you can sort. The sorted output is possible to diff now and then you can color the diff output with delta or a similar tool [2]. diff -u <(kubectl get pod pod1 -o json | gron | sort) <(kubectl get pod pod2 -o json | gron | sort) | delta --light --word-diff-regex="\W+"
This output provides a lot of context for me to see and understand the differences.[1] gron https://github.com/tomnomnom/gron [2] delta https://github.com/dandavison/delta |
|