fix(discovery): prevent duplicate GVKs and avoid stop channel leaks#2869
fix(discovery): prevent duplicate GVKs and avoid stop channel leaks#2869mrueg wants to merge 1 commit intokubernetes:mainfrom
Conversation
|
This issue is currently awaiting triage. If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the The DetailsInstructions 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-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrueg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f72ec93 to
1d0d173
Compare
5d62710 to
fb00999
Compare
In CRDiscoverer.AppendToMap, GVKs were unconditionally appended to the internal map and new stop channels were created on every call. This could lead to duplicate metric registration and leaked channels/goroutines when existing stop channels were overwritten. This change: * Only creates a new stop channel if one does not already exist for the GVK. * Checks for existing Kinds in the discovery map before appending to prevent duplicates.
|
Hi @mrueg , I wanted to quickly jump in as the work I did in #2854 should also address this issue (#2870 would still be needed, as the |
What this PR does / why we need it:
In CRDiscoverer.AppendToMap, GVKs were unconditionally appended to the internal map and new stop channels were created on every call. This could lead to duplicate metric registration and leaked channels/goroutines when existing stop channels were overwritten.
This change:
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Which issue(s) this PR fixes: (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged)Fixes #