-
Notifications
You must be signed in to change notification settings - Fork 925
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 config
drops all comments from kubeconfig file
#1262
Comments
@rm3l: This issue is currently awaiting triage. SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues 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. |
I don't think it is intended behavior, just unfortunate behavior. This happens because it deserializes the yaml, makes the changes, and then serializes it back out. Comments are lost during deserialization. I don't know offhand if there is some way to possibly preserve them, maybe do some kind of patch/merge of the yaml instead of completely overwriting it? |
This may potentially be addressed if we move to a go-yaml v3 which supports comments. Though some work would definitely need to be done to preserve them when serializing with I understand it's annoying to have your comments dropped but right now I would say this is a "won't fix" for us. |
I understand. Thanks, @brianpursley, and @eddiezane for your feedback. |
As discussed this is an unfortunate behavior which can not be fixed easily. I'm closing this and feel free re-open it if you think otherwise. /close |
@ardaguclu: Closing this issue. 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. |
What happened:
I was documenting a relatively big Kubeconfig file, and just noticed that all the comments I had written disappeared after executing a
kubectl config
command to set the namespace of a given context.What you expected to happen:
Not sure if that is the intended behavior (I couldn't find any existing issues related to that, nor any documentation about this), but I would expect my "carefully-crafted" comments to still be there after writing the namespace information with
kubectl config ...
.I've provided minimal reproduction steps below. Am I missing something?
How to reproduce it (as minimally and precisely as possible):
dev-frontend
context, usingkubectl config
:Anything else we need to know?:
I guess this has something to do with the way this YAML document is marshaled/unmarshaled.
Environment:
kubectl version
):KinD
local clustercat /etc/os-release
): Fedora release 36 (Thirty Six)The text was updated successfully, but these errors were encountered: