Crash on nonexistent metric paths in custom resources #1992
Labels
kind/bug
Categorizes issue or PR as related to a bug.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
What happened:
When defining custom metric of nonexistent field,
kube-state-metrics
crashes. This happens for example when referencing some status field in a newly created object which initially does not have status at all (ADDED event).What you expected to happen:
kube-state-metrics
should not crash and ignore the metric.How to reproduce it (as minimally and precisely as possible):
Use the following config (you may substitute Prometheus CRD with something else, but you need to have at least one object of the definition):
and run
kube-state-metrics
:Anything else we need to know?:
Here is a log fragment from a crash:
Environment:
2.8.0
kubectl version
):The text was updated successfully, but these errors were encountered: