-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: Support scraping pods metrics that is still in scheduling status and has no assigned node #2217
fix: Support scraping pods metrics that is still in scheduling status and has no assigned node #2217
Conversation
Signed-off-by: mickeyzzc <mickey_zzc@163.com>
Welcome @mickeyzzc! |
Signed-off-by: mickeyzzc <mickey_zzc@163.com>
Cool! Thanks for it! |
/assign @CatherineF-dev |
Signed-off-by: mickeyzzc <mickey_zzc@163.com>
return EmptyFieldSelector() | ||
pattern := "[^a-zA-Z0-9_,-]+" | ||
re := regexp.MustCompile(pattern) | ||
result := re.ReplaceAllString(n.String(), "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: why we need re.ReplaceAllString(n.String(), "")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove re.ReplaceAllString(n.String(), "")
. If node name isn't correct, keep it as before. Then users can know node name isn't correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: why we need
re.ReplaceAllString(n.String(), "")
There are two considerations for regularization here:
- Handle the difference between "" and nil
- Correction of node name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: could you give two examples for these two cases?
We shouldn't change node name, which users are not aware of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping~
Keep node name as same from input, or return errors during validation. We should not hide errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mickeyzzc can you address this comment?
Signed-off-by: 蓝宝石的傻话 <mickey_zzc@163.com>
dff7885
to
d33929e
Compare
Cool! Seems we can make it without an extra flag. |
Signed-off-by: 蓝宝石的傻话 <mickey_zzc@163.com>
/triage accepted |
Signed-off-by: 蓝宝石的傻话 <mickey_zzc@163.com>
@dashpole Do I need your approval to merge again? |
@mickeyzzc I just did triage, to ensure the PR has an appropriate assignee. You will need approval from the reviewers and assignees on the PR to merge. |
@mickeyzzc: you cannot LGTM your own PR. 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. |
@mrueg Can you help with the merger? |
To my understanding, when someone runs the daemonset for pod metrics, you suggest to have an additional deployment with --node="" to track unassigned pods? Isn't it simpler to include pod metrics with --node="" in the regular ksm deployment that is already there additionally to the DS or does it make sense to have an additional deployment? (I'm not sure how users use this in terms of their metric storage system. @CatherineF-dev might be able to provide insights) And before we can merge, can you update the README so users know how to apply this? |
Yes, this PR wants to fix |
I left one comment here https://github.com/kubernetes/kube-state-metrics/pull/2217/files#r1399988722 that keeping node name as same from input, or return errors during validation. |
Signed-off-by: mickeyzzc <mickey_zzc@163.com>
@mrueg completed |
@@ -276,6 +276,21 @@ spec: | |||
fieldPath: spec.nodeName | |||
``` | |||
|
|||
To track metrics for unassigned pods, you need to add an additional deployment and set `--node=""`, as shown in the following example: | |||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mickeyzzc can you add an empty line before the codeblock to fix the lint? Thanks!
/lgtm Thank you for your contribution! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mickeyzzc, mrueg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
When daemonset is used to scrape the metrics of pods, it can only scrape the metrics of pods assigned to nodes, but in scheduling, for example, pods in pending state cannot be scraped.
This results in pending pods with no indicators to observe and alert.
This pr adds a configuration parameter that, when enabled, captures pending pods from apiservice.