-
Notifications
You must be signed in to change notification settings - Fork 772
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
Handle reports with missing result property #2696
Conversation
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
b4ca00b
to
dccb816
Compare
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
@@ -225,3 +215,8 @@ func isDeletedPolicyKey(key string) (policyName, ruleName string, isDelete bool) | |||
|
|||
return "", "", false | |||
} | |||
|
|||
func mapToStruct(in, out interface{}) error { |
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.
Is mapToStruct
an accurate name here? I don't have a better suggestion unfortunately 😅
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.
@realshuting This PR is a first step to using more strongly typed structs in the code. It saves us a lot type casting all over the place. We would like to do this in more places. Let's check in the next contributor meeting.
Sure. |
* Handle reports with missing result property Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Make use of type structs Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix import Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix cast from map to struct Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Handle reports with missing result property Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Make use of type structs Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix import Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix cast from map to struct Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Handle reports with missing result property Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Make use of type structs Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix import Signed-off-by: Marcus Noble <github@marcusnoble.co.uk> * Fix cast from map to struct Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
Related issue
We experienced an issue where we had PolicyReports without a
result
property in theirresults
. We're not 100% clear how this happened by my best guess is they were previously v1alpha1 and were converted to v1alpha2 incorrectly somehow.The missing
result
property results in Kyverno crashing on startup due to a nil pointer. This change guards against that nil pointer to at least allow Kyverno to start up successfully.Milestone of this PR
What type of PR is this
/kind bug
Proposed Changes
Proof Manifests
N/A
Checklist
Further Comments