-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
CustomResource: no metrics if no resource exists for CRD when ksm starts #2142
Comments
I think the overall issue is in
If the first store has no header set: it will add an empty header for the first store kube-state-metrics/pkg/metrics_store/metrics_writer.go Lines 63 to 65 in bb6e9f4
Afterwards we loop over the headers, and use the index there to write the metrics kube-state-metrics/pkg/metrics_store/metrics_writer.go Lines 66 to 85 in bb6e9f4
In this case, if we have more than one |
Thinking a bit more about it: What |
/assign @dgrisonnet |
@dashpole: The label(s) 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. |
/triage accepted |
i have the same issue and provide the log at #2141 |
Jep, I've seen that issue and also tried the linked PR. Though I was not sure if that describes the same issue. |
This comment was marked as spam.
This comment was marked as spam.
Don't know if I should consider this as spam and report. It does not really provide new and/or useful suggestions which are not already there in the above. |
I woud argue that it does not contain any new info. At least for me, who was not deep into this project before. I would ask not to report, as it just experiement, and I picked a few OSS project to trial my project on real-world problems. And in each project I took up to 5 tickets and PRs. So I'm not going to continue posting this more, unless repository owner will want me to continue. |
If you run any further "experiements", please reach out to any repository owner first and ask them for their okay before targetting their project. Spamming a project (even if it's only 5 tickets) without any sort of opt-in is a pretty rude and non-friendly behavior. To be clear, we do not want you to continue. |
@buger K8s GitHub admin here - For context - We are broadly seeing more LLM / genAI driven comments and PRs. 99% of these comments provide bad advise or are generally useless in terms of code contributions, BUT because they're "written well" or have just enough that seem legit on first pass it takes a lot more effort on the maintainers to deal with. To expand a tad further - there was a recent study that showed 52% of ChatGPT answers were incorrect, and 77% considered too verbose. Admittedly the sample size for it was rather small, so may not be the best study but still rings true anecdotally from what we see. |
If we apply a CRD after starting ksm and then create a CR later, The metrics don't get exposed. |
What happened:
There are two issues when no resources exist for a CRD at the time when kube-state-metrics starts:
HELP
orTYPE
will get exportedWhat you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Used Configuration:
Note: in this case: after creating the resource:
capi_cluster_created
will get exposed, but noHELP
orTYPE
.capi_cluster_status_condition
will not get exposedAnything else we need to know?:
I think the issue got introduced in #1851
If the method
hasResources
which is called here:kube-state-metrics/internal/store/builder.go
Line 548 in cc06755
get's changed to always return true instead of actually tring to list CRs:
kube-state-metrics/internal/store/builder.go
Line 627 in cc06755
it meets the expectation and metrics get exposed as soon as the first CR for the CRD gets created.
Environment:
kubectl version
): v1.27.3The text was updated successfully, but these errors were encountered: