Skip to content
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

kpt live diff is noisy and contains irrelevant changes #1927

Closed
phanimarupaka opened this issue May 7, 2021 · 3 comments
Closed

kpt live diff is noisy and contains irrelevant changes #1927

phanimarupaka opened this issue May 7, 2021 · 3 comments
Assignees
Labels
area/live enhancement New feature or request triaged Issue has been triaged by adding an `area/` label

Comments

@phanimarupaka
Copy link
Contributor

phanimarupaka commented May 7, 2021

I made a small change to nginx package(bumped up replicas), but the live diff shows very verbose output. I expect this diff to be more precise and show me what I need to see.

➜  nginx git:(main) ✗ kpt live status
deployment.apps/my-nginx is Current: Deployment is available. Replicas: 2
service/my-nginx-svc is Current: Service is ready
➜  nginx git:(main) ✗ git diff
diff --git a/deployment.yaml b/deployment.yaml
index cf5dfe5..edc0bb0 100644
--- a/deployment.yaml
+++ b/deployment.yaml
@@ -18,7 +18,7 @@ metadata:
     env: dev
   name: my-nginx
 spec:
-  replicas: 2
+  replicas: 3
   selector:
     matchLabels:
       app: my-nginx
➜  nginx git:(main) ✗ kpt live diff
diff -u -N /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/LIVE-508913543/apps.v1.Deployment.default.my-nginx /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/MERGED-303310138/apps.v1.Deployment.default.my-nginx
--- /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/LIVE-508913543/apps.v1.Deployment.default.my-nginx	2021-05-07 11:30:26.000000000 -0700
+++ /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/MERGED-303310138/apps.v1.Deployment.default.my-nginx	2021-05-07 11:30:26.000000000 -0700
@@ -2,12 +2,11 @@
kind: Deployment
metadata:
  annotations:
-    config.k8s.io/owning-inventory: 1ba35c28fbca811486a6e2c7b74e371245665307-1619805875784412000
    deployment.kubernetes.io/revision: "1"
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{"config.k8s.io/owning-inventory":"1ba35c28fbca811486a6e2c7b74e371245665307-1619805875784412000"},"labels":{"env":"dev"},"name":"my-nginx","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"my-nginx","env":"dev"}},"template":{"metadata":{"labels":{"app":"my-nginx","env":"dev"}},"spec":{"containers":[{"image":"nginx:1.14.1","name":"nginx","ports":[{"containerPort":80}]}]}}}}
  creationTimestamp: "2021-05-07T18:30:06Z"
-  generation: 1
+  generation: 2
  labels:
    env: dev
  managedFields:
@@ -17,14 +16,12 @@
      f:metadata:
        f:annotations:
          .: {}
-          f:config.k8s.io/owning-inventory: {}
          f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:labels:
          .: {}
          f:env: {}
      f:spec:
        f:progressDeadlineSeconds: {}
-        f:replicas: {}
        f:revisionHistoryLimit: {}
        f:selector:
          f:matchLabels:
@@ -100,6 +97,14 @@
    manager: kube-controller-manager
    operation: Update
    time: "2021-05-07T18:30:22Z"
+  - apiVersion: apps/v1
+    fieldsType: FieldsV1
+    fieldsV1:
+      f:spec:
+        f:replicas: {}
+    manager: kpt
+    operation: Update
+    time: "2021-05-07T18:30:26Z"
  name: my-nginx
  namespace: default
  resourceVersion: "38967"
@@ -107,7 +112,7 @@
  uid: a00cdca6-f4b6-48fb-b1a5-e967cb014f5d
spec:
  progressDeadlineSeconds: 600
-  replicas: 2
+  replicas: 3
  revisionHistoryLimit: 10
  selector:
    matchLabels:
diff -u -N /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/LIVE-508913543/v1.Service.default.my-nginx-svc /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/MERGED-303310138/v1.Service.default.my-nginx-svc
--- /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/LIVE-508913543/v1.Service.default.my-nginx-svc	2021-05-07 11:30:26.000000000 -0700
+++ /var/folders/jx/jtq50wxs2h7g1xftcm79qwrw00pyt1/T/MERGED-303310138/v1.Service.default.my-nginx-svc	2021-05-07 11:30:26.000000000 -0700
@@ -2,7 +2,6 @@
kind: Service
metadata:
  annotations:
-    config.k8s.io/owning-inventory: 1ba35c28fbca811486a6e2c7b74e371245665307-1619805875784412000
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"config.k8s.io/owning-inventory":"1ba35c28fbca811486a6e2c7b74e371245665307-1619805875784412000"},"labels":{"app":"nginx","env":"dev"},"name":"my-nginx-svc","namespace":"default"},"spec":{"ports":[{"port":80}],"selector":{"app":"my-nginx","env":"dev"},"type":"LoadBalancer"}}
  creationTimestamp: "2021-05-07T18:30:06Z"
@@ -16,7 +15,6 @@
      f:metadata:
        f:annotations:
          .: {}
-          f:config.k8s.io/owning-inventory: {}
          f:kubectl.kubernetes.io/last-applied-configuration: {}
        f:labels:
          .: {}
exit status 1
@phanimarupaka phanimarupaka added the enhancement New feature or request label May 7, 2021
@frankfarzan
Copy link
Contributor

The core UX issue is that with even with no human authored changes, you see diff like this.

@frankfarzan frankfarzan changed the title kpt live diff is very verbose kpt live diff is noise and contains irrelavant changes May 7, 2021
@frankfarzan frankfarzan changed the title kpt live diff is noise and contains irrelavant changes kpt live diff is noisy and contains irrelevant changes May 7, 2021
@mikebz mikebz added the triaged Issue has been triaged by adding an `area/` label label May 7, 2021
@mortent
Copy link
Contributor

mortent commented May 10, 2021

The diff shown with kpt live diff shows the diff between the local configuration and the actual configuration found in the apiserver. Due to defaulted fields, fields managed by other controllers, and values added by the apiserver, there can be substantial differences from the local configuration. This is the expected behavior and aligned with how kubectl diff works.

One possible way to reduce some of the noise would be if we could allow users to suppress the managedFields information, as it tends to be very verbose. There have been some changes in kubectl around this: kubernetes/kubernetes#90066

Another issue with kpt live diff is that it currently doesn't consider resources deleted from the local state: #412

@mortent
Copy link
Contributor

mortent commented May 25, 2021

We have removed the kpt live diff command, so closing this issue.

@mortent mortent closed this as completed May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/live enhancement New feature or request triaged Issue has been triaged by adding an `area/` label
Projects
None yet
Development

No branches or pull requests

5 participants