-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
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.
|
||
// 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 { |
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 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, "") |
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.
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).
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
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.
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.
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. |
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-standingnodeForControllerPlugin
function. This makes it difficult to sendClientCSI
RPC messages from subpackages ofnomad
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 thenomad.ClientCSI
struct.