-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add debug logs tracking validation of ScaledObjects on webhook #6498
Conversation
Signed-off-by: be0x74a <[email protected]>
Signed-off-by: be0x74a <[email protected]>
Signed-off-by: be0x74a <[email protected]>
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.
I'm wondering if it's safer just to have a map / slice with function names and avoid getting the function name from a program counter. In my past experience, various go compiler optimizations and inlining have made usage of FuncForPC
occasionally a little unstable
@@ -588,3 +594,7 @@ func getHpaName(so ScaledObject) string { | |||
|
|||
return so.Spec.Advanced.HorizontalPodAutoscalerConfig.Name | |||
} | |||
|
|||
func getFunctionName(i interface{}) string { | |||
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).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.
alternatively, if we go forward with FuncForPC
, the code should probably check for nil
ptr because FuncForPC
can return nil, docs. This will future-proof the code a bit in case of go compiler optimizations changing this behavior
Ah okay, wasn't aware of it. Since the lookup is being made only during the scope of one function, maybe it's better to follow your suggestion and create a map with the name + function which will be iterated on |
Signed-off-by: be0x74a <[email protected]>
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, thank you!
/run-e2e internals |
just for the record, I think the linter errors relate to a known buggy implementation of the webhooks - #5962
imho it is not responsibility of this PR to address and fix those |
Add debug logs tracking validation of ScaledObjects on webhook
Checklist
Fixes #
Relates to #