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

Restrict workload selection #62

Closed
dohnto-s1 opened this issue Jun 5, 2023 · 7 comments · Fixed by #103 or #112
Closed

Restrict workload selection #62

dohnto-s1 opened this issue Jun 5, 2023 · 7 comments · Fixed by #103 or #112

Comments

@dohnto-s1
Copy link

Is your feature request related to a problem? Please describe.
One might have a huge cluster and want to focus on optimizing just a particular workload.
Prometheus queries while analysing all worklaods in a cluster/namespace might take too long otherwise.

Describe the solution you'd like
Introduce a new command line argument as kubectl has:

    -l, --selector='':
	Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). Matching
	objects must satisfy all of the specified label constraints.

to limit the workload selection. E. g:

krr simple --context my-cluster --namespace kube-system --selector app-instance=metrics-server
# or
krr simple --context my-cluster --namespace kube-system --selector owner=devops

Describe alternatives you've considered

krr simple --context my-cluster --namespace kube-system --workload Deployment/metrics-server

Additional context

Thanks for this wonderful tool. Happy to learn if there is alternative solution for me.

@dohnto-s1
Copy link
Author

Now I hit an issue when Prometheus is unable to give me the results and the request fails with 431. I don't understand the details krr, but would implementation of feature above help as well?

PrometheusApiClientException: HTTP Status Code 431 (b'431 Request Header Fields Too Large')

@arikalon1
Copy link
Contributor

Thanks for reporting it @dohnto-s1

I think this issue is similar to #60

Does limiting krr to a specific namespace using krr simple -n default can be a workaround until we fix it?

@dohnto-s1
Copy link
Author

This unfortunately happens when running with -n.

@arikalon1
Copy link
Contributor

Thanks for the update.

We'll try to fix it soon.
We're also open for PRs

@LeaveMyYard
Copy link
Contributor

Now I hit an issue when Prometheus is unable to give me the results and the request fails with 431. I don't understand the details krr, but would implementation of feature above help as well?

PrometheusApiClientException: HTTP Status Code 431 (b'431 Request Header Fields Too Large')

Hey, sorry for long time waiting :)

It looks like your issue could be handled by #96
Can you check that?

If it does not, please provide logs after running with -v flag

@LeaveMyYard
Copy link
Contributor

And I really like your proposal for selector flag, we should 100% implement it

@dohnto-s1
Copy link
Author

dohnto-s1 commented Jul 12, 2023

@LeaveMyYard Looks awesome, thanks!

EDIT: Let me test it first on some of my use-cases.
EDIT2: Works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants