Skip to content
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: Avoid panic when inventory update errors #4055

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

karlkfi
Copy link
Contributor

@karlkfi karlkfi commented Oct 6, 2023

Fix two bugs in the inventory provider:

  • Avoid null pointer panic when inventory update errors (appliedObj was nil)
  • Avoid losing inventory modifications caused to mutating webhooks (e.g. annotations)

Also avoid losing modifications due to mutating webhooks.

Signed-off-by: Karl Isenberg <[email protected]>
@karlkfi karlkfi force-pushed the karl-fix-live-provider-panic branch from 7aa0f24 to e84f326 Compare October 6, 2023 22:19

// Update status.
// Update status, if status policy allows it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some unit tests here would be nice to have if it's not too cumbersome

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding unit tests would require faking the dynamic.Interface and meta.RESTMapper. The fakes I wrote are in kpt-config-sync downstream, which make them hard to use here. If we want to use the fake clients in kpt, we'll have to upstream the fakes into cli-utils first.

So adding unit tests might be more effort than it's worth at this point.

@mortent mortent merged commit fc62243 into kptdev:main Oct 9, 2023
11 checks passed
@karlkfi karlkfi deleted the karl-fix-live-provider-panic branch October 9, 2023 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants