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

periodic GC for CSI plugins #7878

Merged
merged 6 commits into from
May 6, 2020
Merged

periodic GC for CSI plugins #7878

merged 6 commits into from
May 6, 2020

Conversation

tgross
Copy link
Member

@tgross tgross commented May 6, 2020

For the plugin half of #7825

This changeset implements a periodic garbage collection of unused CSI plugins. Plugins are self-cleaning when the last allocation for a plugin is stopped, but this feature will cover any missing edge cases and ensure that upgrades from 0.11.0 and 0.11.1 get any stray plugins cleaned up.

Best reviewed commit-by-commit. 71ad02d includes the addition of a UpsertCSIPlugin method on the state store which is primarily to support testing (the normal way plugins get updated is through node updates); we could probably refactor some of our other tests to use this as well.

@tgross tgross marked this pull request as ready for review May 6, 2020 17:48
@tgross tgross requested a review from langmartin May 6, 2020 17:48
@tgross
Copy link
Member Author

tgross commented May 6, 2020

There's a test flake that's been popping up in test-client the last couple days and isn't in-scope for this PR, but this is otherwise ready for review.

Copy link
Contributor

@langmartin langmartin left a comment

Choose a reason for hiding this comment

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

LGTM

// UpsertCSIPlugin writes the plugin to the state store. Note: there
// is currently no raft message for this, as it's intended to support
// testing use cases.
func (s *StateStore) UpsertCSIPlugin(index uint64, plug *structs.CSIPlugin) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

req.Region = c.srv.Region()
err := c.srv.RPC("CSIPlugin.Delete", req, &structs.CSIPluginDeleteResponse{})
if err != nil {
if err.Error() == "plugin in use" {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a shame to do this with string matching, but I can't think of anything else reasonably easy.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now that we're on golang 1.14, it'd be worth making sure all our error strings have proper error types so we can test them with errors.Is(). But for now this will do I guess. 😁

@tgross tgross merged commit 9990650 into master May 6, 2020
@tgross tgross deleted the csi_periodic_gc branch May 6, 2020 20:49
@github-actions
Copy link

github-actions bot commented Jan 7, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants