-
Notifications
You must be signed in to change notification settings - Fork 34
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
Filter pools based on labels #817
Conversation
pool_labels: HashMap<String, String>, | ||
labels: Labels, | ||
) -> Result<bool, SvcError> { | ||
for label in labels.split(',') { |
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'm confused, doesn't the hashmap already have key and value? Why do we need further parsing?
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.
no, the query params comes as a string lie A=B,C=D
and here it is parsed. The labels of the pool are a hashmap
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.
Looks like that's an openapi limitation due to using query rather than body.
Let's change it from string to hashmap on the grpc proto.
name: topology_label | ||
required: true | ||
schema: | ||
$ref: '#/components/schemas/TopologyLabel' |
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.
Should be a map?
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.
topology_label is a query param, and its passed as string A=B,C=D,E=F
. Cant pass map as a query param .
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.
Alright, then let's label the type TopologyLabels
and add comments to say how it's meant to be used
@@ -117,6 +117,7 @@ impl From<CtrlPoolState> for models::PoolState { | |||
|
|||
rpc_impl_string_id!(PoolId, "ID of a pool"); | |||
rpc_impl_string_uuid!(PoolUuid, "UUID of a pool"); | |||
rpc_impl_string_id!(Labels, "Labels of a pool"); |
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.
Why are we adding labels as an identifier?
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.
It is used as a filter criteria here
Signed-off-by: sinhaashish <ashi.sinha.87@gmail.com>
Signed-off-by: sinhaashish <ashi.sinha.87@gmail.com>
Signed-off-by: sinhaashish <ashi.sinha.87@gmail.com>
Signed-off-by: sinhaashish <ashi.sinha.87@gmail.com>
…ator Signed-off-by: sinhaashish <ashi.sinha.87@gmail.com>
closing this as PR #823 contains the same functionality and is merged |
This will be used for the command
kubectl mayastor get pools --labels A=B,C=D