-
Notifications
You must be signed in to change notification settings - Fork 896
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
Kubectl edit: --show-managed-fields
does nothing
#1322
Comments
@alvaroaleman: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig cli |
/transfer kubectl |
This is inherited from the JSON printer. We need a refactor of this to its own flag struct that can be added to the commands that use it. /triage accepted |
@eddiezane: GitHub didn't allow me to assign the following users: henvic. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
I'm working on this change, but when I was investigating ShowManagedFields I noticed some remarks that might be worth discussing before opening a PR: From the direction server-side apply took (see Kubernetes 1.18 Feature Server-side Apply Beta 2), it seems that the However, I've also read some comments that made me wonder if we should consider deprecating the flag for this command. For example, I've found this two-years-old comment on the task #91946: Strip .meta.managedFields for kubectl edit command that indicates it shouldn't be removed, but on a later comment I see @lavalamp suggested that the command could fail with a message saying that Comments? /cc @lavalamp, @eddiezane Further reference: |
|
@alvaroaleman, is the reason why you want this change just to open the YAML on your editor for viewing (and not really editing)? If it's the case, do you typically just go to the editor and ^c the kubectl process immediately to avoid editing your resources by mistake? Not sure if this is appropriate, but have you considered suggesting an --editor flag for |
If you want to modify managedFields--which is rare but occasionally necessary, mostly by logic transitioning objects from CSA to SSA--you CAN do it, but you have to use GET / PUT. |
There's no SSA with That being said, I think editing managed fields though |
Right, I don't want to actually edit them. I want to look at them with proper highlighting in a proper editor without having to do a I don't think I am the only one doing this, because in a project of mine someone asked for edit functionality for this reason, without actually wanting to edit anything: alvaroaleman/static-kas#4
That seems like a great idea. |
I think we should make edit use SSA in the future, then. I guess I don't object to showing the field as long as it prevents you from modifying it? If people get into the habit of modifying it we wouldn't be able to use SSA in the future... |
Should we drop this in favor of #1328 for now? It seems more appropriate to the issue @alvaroaleman is trying to solve, and while I understand some might want to be able to edit managedFields using the command, it is unclear to me if the trade-off of making it editable is worth the price and the other option (returning it but not making them editable) seems to carry some learning curve / cognitive load (and might lead to unwanted surprising behavior) as well. What do you think? |
I was trying to trace back to the reasons why you wanted to do that. There it is :-) I think we should honor the |
I'm fine with that as long as users are warned or get an error if they do try to change them (rather than silently not doing what they asked for). |
@henvic are you planning to work on this issue? |
When the flag --show-managed-fields is set, the command kubectl edit should show the managedFields in the editor. If the user tries to edit change any property, it lets them but returns a warning that editing managed fields does not use Server-Side Apply. Task: kubernetes/kubectl#1322
Hi @ardaguclu, I've just opened a pull request for this feature at kubernetes/kubernetes#115121 |
This issue has not been updated in over 1 year, and should be re-triaged. You can:
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/ /remove-triage accepted |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What happened?
I edited an object like so
kubectl edit svc my-server --show-managed-fields
and epected to see managed fields but didn't. When usingkubectl get -oyaml --show-managed-fields
they are shownWhat did you expect to happen?
See managed fields
How can we reproduce it (as minimally and precisely as possible)?
kubectl edit some-type some-name --show-managed-fields
Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: