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

refactor: make nodeForControllerPlugin private to ClientCSI #7688

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

tgross
Copy link
Member

@tgross tgross commented Apr 10, 2020

This work came out of ongoing work I'm doing for #7629.

The current design of ClientCSI RPC requires that callers in the server know about the free-standing nodeForControllerPlugin function. This makes it difficult to send ClientCSI RPC messages from subpackages of nomad and adds a bunch of boilerplate to every server-side caller of a controller RPC.

This changeset makes it so that the ClientCSI RPCs will populate and validate the controller's client node ID if it hasn't been passed by the caller, centralizing the logic of picking and validating controller targets into the nomad.ClientCSI struct.

The current design of `ClientCSI` RPC requires that callers in the
server know about the free-standing `nodeForControllerPlugin`
function. This makes it difficult to send `ClientCSI` RPC messages
from subpackages of `nomad` and adds a bunch of boilerplate to every
caller for a controller RPC.

This changeset makes it so that the `ClientCSI` RPCs will populate and
validate the controller's client node ID if it hasn't been passed by
the caller, centralizing the logic of picking and validating
controller targets into the `nomad.ClientCSI` struct.
@tgross tgross requested a review from langmartin April 10, 2020 19:43
@tgross tgross added this to the 0.11.1 milestone Apr 10, 2020

// controllerPublishVolume sends publish request to the CSI controller
// plugin associated with a volume, if any.
func (srv *Server) controllerPublishVolume(req *structs.CSIVolumeClaimRequest, resp *structs.CSIVolumeClaimResponse) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

I dunno why we originally had this sitting in Server instead of ClientCSI, but it doesn't need to be exposed at that level anymore. Moved it up with the rest of the methods for ClientCSI


plugin, err := state.CSIPluginByID(ws, "minnie")
require.NoError(t, err)
nodeID, err := srv.staticEndpoints.ClientCSI.nodeForController(plugin.ID, "")
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the only test change. It got moved from csi_endpoint_test.go and this line was the only required change (b/c of the new signature).

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

@tgross tgross merged commit 09abe0c into master Apr 10, 2020
@tgross tgross deleted the r-csi-rpc-refactor branch April 10, 2020 20:47
tgross added a commit that referenced this pull request Apr 13, 2020
Follow-up for a method missed in the refactor for #7688. The
`volAndPluginLookup` method is only ever called from the server's `CSI`
RPC and never the `ClientCSI` RPC, so move it into that scope.
tgross added a commit that referenced this pull request Apr 13, 2020
Follow-up for a method missed in the refactor for #7688. The
`volAndPluginLookup` method is only ever called from the server's `CSI`
RPC and never the `ClientCSI` RPC, so move it into that scope.
@github-actions
Copy link

github-actions bot commented Jan 9, 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 9, 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.

2 participants