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-apply silently drops annotations with boolean values #59113
Comments
/sig cli |
I believe it's by the implementation of json-iterator.
jsoniter maps bytes into corresponding resource object without any warning.
|
Annotation values must be strings. Something should generate an error, though |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
sadly, i'm afraid the annotations will keep typed |
@yue9944882 , thats fine, bug is more about |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
There needs to be a way for |
@code-sleuth, are you working on this issue? if not, can i look at this issue? |
Hey @vithati , i'm working on it. I have some changes that i'm still discussing with @juanvallejo before i raise my PR. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
I understand boolean values are not allowed, however I am seeing that if i attempt to kubectl apply a yaml with a new boolean annotation, not only will it not add the new annotation, but it will also delete all existing annotations silently. this seems like more than an error messaging bug |
FWIW -- this hit me and it was very confusing. What it looks like happens now (at least with kubectl v1.14.0 against v1.12.6-gke.10 is that the entire annotation map is not updated. No error is returned from kubectl. |
This hit me too. Very confusing behavior. It cost 2 man-hours to understand the root cause. |
I'm currently unable to deploy via kubectl apply -f due to this issue. Is there a way around it?
|
I have tracked down the root cause of this problem being the omission of error propagation in this Object interface. The error is dropped in the implementation of GetAnnotations, but is emitted by NestedStringMap. I’m going to present all of the solutions that I can think of:
Any other suggestions are welcome, and I’d like to hear from the community to find the most elegant solution to this critical problem. There may be other functions in this interface where we should pass an error as well. I’ve submitted a PR to implement what was described in bullet 1 and 2. Thank you! Griffin Dunn |
Hm, Set* methods also return no errors, therefore you can SetAnnotation and receive different result back on subsequent GetAnotations breaking symmetry. I doubt API change is acceptable on that level, so there should be either some higher level type check of arts before descending into Unstructured codepath , for instance instantiate desired object as a typed object to see if passes all the checks. |
/kind bug
What happened:
When creating resource with boolean value in annotation, kubectl apply completes sucessfully without any errors, but resource has no annotations.
What you expected to happen:
Error similar to what
kubectl create
returnsHow to reproduce it (as minimally and precisely as possible):
Creates:
Environment:
The text was updated successfully, but these errors were encountered: