-
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: panic in util.GVRFromType
for structured types
#2553
base: main
Are you sure you want to change the base?
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 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-sigs/prow repository. |
26c0292
to
8859a42
Compare
Thanks, makes sense to me. /lgtm /hold |
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.
+1 for the change proposed, just one nit.
pkg/util/utils.go
Outdated
apiVersion := expectedType.(*unstructured.Unstructured).Object["apiVersion"].(string) | ||
t, err := meta.TypeAccessor(expectedType) | ||
if err != nil { | ||
panic(err) |
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.
CRS errors should ideally not crash KSM as that would result in downtime for native metrics that have nothing to do with this logic. Can we surface the error up?
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.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: L3n41c, 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 |
t, err := meta.TypeAccessor(expectedType) | ||
if err != nil { | ||
klog.ErrorS(err, "Failed to get type accessor", "expectedType", expectedType) | ||
return nil |
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.
Apologies to block this again, but since this is used in a bunch of critical paths in CRS procedures, continuing silently after an error wouldn't make sense. I'd push for changing the signature here, and surfacing this up, as pointed in my previous review.
What this PR does / why we need it:
Make
util.GVRFromType
able to process structured types and not only unstructured ones.How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Does not change.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):customresource
interface andcustomresource
causes panic #2202