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
Change kubectl diff to exclude managedFields by default #111319
Conversation
/hold for review |
Flag renamed to |
Thanks for the PR @brianpursley! In my opinion, we may not need new flag to fix that problem;
In my opinion this new To sum up, if there is a regression that means |
Thanks @ardaguclu. I'll need to look at that other commit you referenced and understand it better. Something I noticed when I looked at the live and merged files being compared is that the managed fields came back in a different order (reversed) in the live vs the merged, and that was the cause of the big diff in the example output I posted. So it could also be an ordering problem and maybe it can be fixed if managed fields are always returned in a consistent order so that the diff doesn't pick up the reordering as a change. |
@brianpursley you are right, always updating time fields is causing different ordering each time(and diff results). Because fields are sorted according to time field Line 194 in 862d256
When I disable sorting manually, diff works as expected. I wonder can we handle that case somehow in diff command. |
Maybe the best option is like you said hiding altogether and only show them when user passes |
@ardaguclu thanks for looking into it further. Your explanation makes sense to me. I think it is preferable for diff to exclude managed fields by default. Including them doesn't seem like helpful information to me. I actually would be OK with always excluding the managed fields and not even having the I guess we start without the flag and if there is demand for that capability, then add the flag to allow managed fields to be included. |
Thanks, maybe like you said we can directly disable managedfields and will expose this flag if there is any demand? but I'm fine both options. Your PR also looks good to me but I wonder why none of integration tests did not fail and maybe we need one for managedField case? |
If the output as-is is always useless, then this makes sense to me. I don't see the sense in maintaining a flag for something that isn't helpful. If we do have a flag, I'd expect we'd need to find a way to fix the problem of the diffing essentially not working for managed fields before exposing it. That said, since this is a behaviour change either way, I suggest we discuss this briefly at tomorrow's meeting. |
I personally believe that diffing the managed fields is generally useful. The other mentioned error is definitely not a bug. On the other hand, I agree that the re-ordering of managers in this case is not super helpful. I'm curious if there's something we can do about that. |
dc96205
to
2a6cb9c
Compare
Changes kubectl diff to exclude managedFields by default. Adds a new --show-managed-fields flag that allows you to include managed fields in the diff.
2a6cb9c
to
e88470c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/priority important-longterm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brianpursley, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
1 similar comment
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Changes kubectl diff to exclude managedFields by default.
Adds a new --show-managed-fields flag that allows you to include managed fields in the diff.
Which issue(s) this PR fixes:
Fixes kubernetes/kubectl#1242
Special notes for your reviewer:
New Output:
Old output:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: