kapp
kapp copied to clipboard
filename reference in error output
What steps did you take:
Deploying a set of spec files where one of them has an error. No idea which one...
What happened:
There is no reference in the error message to the file or even line to be able to trace back the issue.
kapp: Error: Trying to apply empty set of resources will result in deletion of resources on cluster. Refusing to continue unless --dangerous-allow-empty-list-of-resources is specified.
or:
╰─➤ kapp app-group deploy -g all -n default --directory kappsvc -c
kapp: Error: error unmarshaling JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
What did you expect:
like kubectl reference the filename and the line where this problem occurs
Environment:
- kapp version 0.50.0
- OS Ubuntu 22.04
- Kubernetes version 1.22
Vote on this request
This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.
👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"
We are also happy to receive and review Pull Requests if you want to help working on this issue.
Hi @universam1! The error
kapp: Error: Trying to apply empty set of resources will result in deletion of resources on cluster. Refusing to continue unless --dangerous-allow-empty-list-of-resources is specified.
generally means that the file is empty or doesn't have a resource present in it. Would you be able to share the file(s) content that you are trying to apply for better understanding of the issue?
@praveenrewar Thanks, you and Kapp, are right that there is an empty file, errorously generated through our helm templating. However we do not know which file, this information is missing in the error log. So this issue is only about enriching the error output with file name and line reference
i think it's saying that it was not given any resources in any of the files.
i think it's saying that it was not given any resources in any of the files.
Ok, I'll check that, thanks
Another instance where the filename is missing, leaving one puzzled:
╰─➤ kapp app-group deploy -g all -n default --directory kappsvc -c
--- deploying app 'all-services' (namespace: default) from kappsvc/services
kapp: Error: error unmarshaling JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
Also running in --debug does not give any hint either
kapp: Error: error unmarshaling JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
Yeah, I agree that file source description should be added in this case. Thanks for pointing it out 😄 And feel free to create a PR for the same :)
(BTW, the error would typically mean that there is a doc in one of the files in kappsvc/services
which isn't a valid yaml.)
I think we can wrap this error to include the fileSrc.Description and the doc index. We might just have to see how the error looks in different scenarios (for example stdin source).
@praveenrewar as another instance - would this error also be extended with the affected filename?
Target cluster 'https://xxxx.gr7.us-east-1.eks.amazonaws.com' (nodes: ip-172-16-4-11.ec2.internal, 2+)
error="error converting YAML to JSON: yaml: line 2: mapping values are not allowed in this context"
Seems like it. Although I am wondering about error="error converting...
, we usually have errors wrapped with kapp: Error: ...
🤔
we usually have errors wrapped with
kapp: Error: ...
🤔
😊 This is due to us using Kapp as module now https://github.com/vmware-tanzu/carvel-kapp/issues/564#issuecomment-1203639470
Marking this as an enhancement to the existing error message. @universam1 , Would be great if you could help us out by contributing to this issue. We will prioritise the review for this.
@renuy Happy to contribute, I am currently in vacation please have a couple of weeks patience, thanks
Still interested in this as well, would be a nice improvement