Skip to content

Restrict workload selection #62

Closed

Description

@dohnto-s1

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.

Activity

  1. dohnto-s1 commented on Jun 5, 2023

    @dohnto-s1
    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')

  2. arikalon1 commented on Jun 5, 2023

    @arikalon1
    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?

  3. dohnto-s1 commented on Jun 5, 2023

    @dohnto-s1
    Author

    This unfortunately happens when running with -n.

  4. arikalon1 commented on Jun 5, 2023

    @arikalon1
    Contributor

    Thanks for the update.

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

  5. LeaveMyYard commented on Jul 5, 2023

    @LeaveMyYard
    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

  6. LeaveMyYard commented on Jul 5, 2023

    @LeaveMyYard
    Contributor

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

  7. dohnto-s1 commented on Jul 12, 2023

    @dohnto-s1
    Author

    @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions