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

Add whitelist filters to commands #65

Open
michaelmdresser opened this issue Apr 12, 2021 · 6 comments
Open

Add whitelist filters to commands #65

michaelmdresser opened this issue Apr 12, 2021 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@michaelmdresser
Copy link
Contributor

We currently provide no way to filter output, something like kubectl cost namespace --whitelist ns1,ns2,ns3 which would only display cost data for namespaces ns1, ns2, and ns3.

The backing /aggregatedCostModel API provides filtering and so does the /allocation API.

They do so in different ways, however, making this a little more complicated than just passing a filter through to the API call.

@michaelmdresser
Copy link
Contributor Author

This should hold until #90 is complete which will simplify this issue substantially.

@Adam-Stack-PM
Copy link

@michaelmdresser Closing out as #90 is complete. Please reopen if needed.

@michaelmdresser
Copy link
Contributor Author

michaelmdresser commented Jun 13, 2022

This is an uncompleted improvement, so I'm reopening. #90 just moved the backing API to something that supports filtering. We still need to do the extra bit of work to add filtering flag(s) to kubectl cost.

@michaelmdresser
Copy link
Contributor Author

Now that we have "v2 filters" I think we can just expose a standard filter string that gets passed to the backend!

Example usage: kubectl cost namespace --filter 'container:"cost-model"'

Filter language docs: https://github.com/kubecost/docs/blob/main/filters-api.md. Shouldn't be too necessary because the BE handles all parsing. Just pass the string to the filter query parameter.

@michaelmdresser michaelmdresser added the good first issue Good for newcomers label Mar 1, 2023
@vladComan0
Copy link
Contributor

I'd like to take a look on this if the issue is still relevant. Note that the filter language docs link does not work anymore.

@michaelmdresser
Copy link
Contributor Author

This is certainly still relevant. The current docs link is https://docs.kubecost.com/apis/filters-api. It is my strong recommendation to "Just pass the string to the filter query parameter" because the backend APIs already implement the complex logic outlined in the documentation which is standardized in the product.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants