-
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
CSI: remove prefix matching from CSIVolumeByID and fix CLI prefix matching #10158
Conversation
6328fb5
to
e2e60a4
Compare
@@ -28,11 +28,6 @@ func (v *CSIVolumes) List(q *QueryOptions) ([]*CSIVolumeListStub, *QueryMeta, er | |||
return resp, qm, nil | |||
} | |||
|
|||
// PluginList returns all CSI volumes for the specified plugin id | |||
func (v *CSIVolumes) PluginList(pluginID string) ([]*CSIVolumeListStub, *QueryMeta, error) { | |||
return v.List(&QueryOptions{Prefix: pluginID}) |
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.
CSIVolumes.List
has always been how you get this info, and this code has never worked. It has no callers either, so I'm removing here... I can't imagine this will break anyone's code given that it didn't work. But tagging @cgbaker as a reviewer to see if he has a different opinion.
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.
sounds good to me; we're not using it in the terraform provider, just using List
Callers of `CSIVolumeByID` are generally assuming they should receive a single volume. This potentially results in feasibility checking being performed against the wrong volume if a volume's ID is a prefix substring of other volume (for example: "test" and "testing").
Removing the incorrect prefix matching from `CSIVolumeByID` breaks prefix matching in the command line client. Add the required elements for prefix matching to the commands and API.
e2e60a4
to
25782f3
Compare
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.
a couple of questions about blocking queries and CLI handling when prefix search returns no matches.
@@ -28,11 +28,6 @@ func (v *CSIVolumes) List(q *QueryOptions) ([]*CSIVolumeListStub, *QueryMeta, er | |||
return resp, qm, nil | |||
} | |||
|
|||
// PluginList returns all CSI volumes for the specified plugin id | |||
func (v *CSIVolumes) PluginList(pluginID string) ([]*CSIVolumeListStub, *QueryMeta, error) { | |||
return v.List(&QueryOptions{Prefix: pluginID}) |
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.
sounds good to me; we're not using it in the terraform provider, just using List
@@ -91,6 +93,24 @@ func (c *VolumeDeregisterCommand) Run(args []string) int { | |||
return 1 | |||
} | |||
|
|||
// Prefix search for the volume |
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.
🏆 these are so helpful to have...
…ching (#10158) Callers of `CSIVolumeByID` are generally assuming they should receive a single volume. This potentially results in feasibility checking being performed against the wrong volume if a volume's ID is a prefix substring of other volume (for example: "test" and "testing"). Removing the incorrect prefix matching from `CSIVolumeByID` breaks prefix matching in the command line client. Add the required elements for prefix matching to the commands and API.
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. |
Callers of
CSIVolumeByID
are generally assuming they should receive a single volume. Among other possible bugs, this potentially results in feasibility checking being performed against the wrong volume if a volume's ID is a prefix substring of other volume. Discovered this while working on #10136 because of"test"
vs"test[0]"
But removing the incorrect prefix matching from
CSIVolumeByID
breaks prefix matching in the command line client. Add the required elements for prefix matching back to the commands and API.