vscode-kubernetes-tools / vscode-kubernetes-tools

Kubernetes extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools
Apache License 2.0
691 stars 248 forks source link

"diff" shows more changes than CLI #682

Open chrmarti opened 4 years ago

chrmarti commented 4 years ago

When I change the number of replicas, the kubectl diff shows that line and the generation line as changed. When I run the extension's Diff command I get many more changes which seems unexpected and makes it hard to read: image

chrmarti commented 4 years ago

The same diff is shown with the "Apply" command.

itowlson commented 4 years ago

Thanks. I'm guessing kubectl diff uses some awareness of defaults and metadata of what can be skipped, whereas we do a kubectl get and a naive VS Code diff. I'll take a look.

brendandburns commented 4 years ago

Docs are here: https://kubernetes.io/blog/2019/01/14/apiserver-dry-run-and-kubectl-diff/

We should do kubectl apply --dry-run instead of just using the file-system.

bkmeneguello commented 4 years ago

I had this issue today, the naive diff is barely usable. Make use of Kubernetes diff is a must.

bkmeneguello commented 4 years ago

I suppose it should be simple to modify extension#diffKubernetesCore to make use of kubectl.invokeCommandThen(`diff -f ${fileUri}`, ...)