GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Prometheus workload loader by LeaveMyYard · Pull Request #266 · robusta-dev/krr

Conversation

@LeaveMyYard

@LeaveMyYard LeaveMyYard commented Apr 22, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Implemented ability to select an alternative workload loader
  • Implemented Prometheus workload loader
  • Refactored Kube API workload loader: moved separate logic (for each Kind) to a separate class
  • List clusters on centralized prometheus
  • Scanning multiple clusters in prometheus mode?
  • Test running from robusta UI
  • Test prometheus mode on centralized prometheus
  • A lot of testing
  • Fix tests (mocks are now broken)

Testing issues found:

  • For some reason auto-discovery does not work
  • Prometheus mode does not gather HPA data
  • Something is now broken with HPAKey

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danielhass, wad-hongsumin, patsevanton, mard3n, and jkrivas reacted with thumbs up emoji
All reactions
  • 👍 5 reactions
@LeaveMyYard
Add multiple workload loaders, refactor kubeapi workload loader
4fedd82
@LeaveMyYard LeaveMyYard self-assigned this Apr 22, 2024
LeaveMyYard and others added 5 commits April 22, 2024 18:30
@LeaveMyYard @lujiajing1126
Moved the logic from #93 for a new refined structure
c7ad1cd
Co-authored-by: Megrez Lu <[email protected]>
@LeaveMyYard
Implement remaining kinds in prometheus workload loader
bf90978
@LeaveMyYard
Filter Cronjob-created jobs from display
7cd0c59
@LeaveMyYard
Fix cluster selector
4044b4a
@LeaveMyYard
Minor bug fix
b9a62a0
@LeaveMyYard LeaveMyYard mentioned this pull request Apr 26, 2024
Support prom discovery #93
Closed
1 of 3 tasks
LeaveMyYard added 4 commits April 29, 2024 23:18
@LeaveMyYard
BaseClusterLoader, class structure change, not finished
7e8f1f4
@LeaveMyYard
Finished structure changes and workload loaders
4c1f5c9
@LeaveMyYard
PrometeusClusterLoader.list_clusters implementation
7124c80
@LeaveMyYard
Minor additional logging improvements
d1ad17d
@LeaveMyYard
LeaveMyYard requested a review from aantn April 30, 2024 15:56
@LeaveMyYard
LeaveMyYard marked this pull request as ready for review April 30, 2024 15:56
LeaveMyYard and others added 11 commits April 30, 2024 18:59
@LeaveMyYard
Minor debug comment
f7d8412
@LeaveMyYard
Merge branch 'main' into prometheus-workload-loader
09c372b
@LeaveMyYard
Fix prometheus auto-discovery
59cc29d
@LeaveMyYard
Merge branch 'prometheus-workload-loader' of https://github.com/robus…
d4adcf8
…ta-dev/krr into prometheus-workload-loader
@LeaveMyYard
Logging improvement
eb84c95
@LeaveMyYard
Add HPA detection for prometheus mode
e350084
@LeaveMyYard
Fix tests
d4e09b0
@LeaveMyYard
Rework ckyster selector for prometheus mode
7b6be35
@LeaveMyYard
Remove test raise
dce207f
@LeaveMyYard
Fix HPAKey
43ffb7f
@LeaveMyYard
One more HPAKey fix
2403898
This was referenced May 7, 2024
Provide recommendations for historical deployments #171
Open
Support metrics-based workload discovery #59
Open
@aantn aantn mentioned this pull request May 14, 2024
Recommendations missing for some sidecars #276
Open
@deutschj

deutschj commented May 22, 2024

Copy link
Copy Markdown

When testing using the prometheus mode on a centralized Prometheus (VictoriaMetrics), I encountered the following errors.
I specified the labels --prometheus-label and --prometheus-cluster-label according to the docs:

python krr.py simple -p https://vmauth.xxx.com --prometheus-auth-header "<redacted>" --prometheus-label cluster -l k8s0-q --mode prometheus

image

To me it seems that the query includes the wrong label here, and should be avg by(cluster) instead of using the cluster name.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aantn
Deprecate --prometheus-cluster-label
73eb5f3
The name is misleading. Before this change we had both --prometheus-cluster-label and --prometheus-label which referred to very different things, leading to a bug in the code (to be fixed in the next commit).

We still support -l and have added support for  "--prometheus-cluster-value" which is what `-l` really represents.
arikalon1
arikalon1 reviewed Jun 14, 2024
View reviewed changes
Comment thread README.md

```sh
krr.py simple --prometheus-label cluster -l my-cluster-name
krr.py simple --prometheus-cluster-key cluster -l my-cluster-name

@arikalon1 arikalon1 Jun 14, 2024

Copy link
Copy Markdown
Contributor

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.

@aantn I think this requires a change on the robusta-runner as well
see here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aantn aantn Jun 14, 2024

Copy link
Copy Markdown
Contributor

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.

@arikalon1 it should be fine. I'm not deprecating --prometheus-label, just adding another option with a name that makes more sense.

I did deprecate --prometheus-cluster-label but the runner doesn't pass that by default.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
arikalon1
arikalon1 reviewed Jun 14, 2024
View reviewed changes
Comment thread robusta_krr/main.py
prometheus_cluster_label: Optional[str] = typer.Option(
None,
"--prometheus-cluster-label",
"--prometheus-cluster-value",

@arikalon1 arikalon1 Jun 14, 2024

Copy link
Copy Markdown
Contributor

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.

same

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@aantn aantn Jun 14, 2024

Copy link
Copy Markdown
Contributor

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.

Yes, this one I did change but if I understand the runner code correctly, it uses -l which is still supported and equivalent to this flag. So no change needed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aantn
Bug fix - thank you @deutschj
24af7f5
See #266 (comment)
@aantn

aantn commented Jun 14, 2024

Copy link
Copy Markdown
Contributor

Hi @deutschj,
You're correct of course! I've pushed a fix. Can you please test?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aantn

aantn commented Jun 14, 2024

Copy link
Copy Markdown
Contributor

@deutschj please note that I changed the name of the flags a little -- see --help if necessary.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@deutschj

deutschj commented Jun 27, 2024

Copy link
Copy Markdown

@aantn Sure, thanks a lot for working on the bugfix!

Whett testing with the options --prometheus-cluster-key and -l I encountered the following error:

krr git:(prometheus-workload-loader) python krr.py simple --prometheus-url https://vmauth.xxx.com --prometheus-auth-header "<redacted>" --mode prometheus --prometheus-cluster-key cluster -l k8s0-q

Running Robusta's KRR (Kubernetes Resource Recommender) 1.8.2-dev
Using strategy: Simple
Using formatter: table
A newer version of KRR is available: v1.11.0

[08:22:56] INFO     Connecting using Prometheus, will load the kubeconfig.
           INFO     Using Prometheus at https://vmauth.xxx.com
           INFO     Prometheus found
           INFO     Prometheus connected successfully            
[08:22:57] INFO     Clusters available: k8s0-q, <cluster1>, <cluster2>, [...]
           CRITICAL Cannot scan multiple clusters for this prometheus, Rerun with the flag `-c <cluster>` where <cluster> is one of ['k8s0-q', '<cluster1>', '<cluster2>', [...]]

However, when providing only the -l option without the --prometheus-cluster-key, KRR starts to generate recommendations for the selected cluster. When generating, the following warnings are displayed for every existing workload:

WARNING  Prometheus returned no PercentileCPULoader metrics for StatefulSet xxx
WARNING  Prometheus returned no MaxMemoryLoader metrics for StatefulSet xxx
WARNING  Prometheus returned no CPUAmountLoader metrics for StatefulSet xxx
WARNING  Prometheus returned no MemoryAmountLoader metrics for StatefulSet xxx
INFO     Calculated recommendations for StatefulSet xxx (using 4 metrics)

And the table with the generated resource recommendations in the end is empty though.
So looks like now getting the existing workloads in the cluster works correctly, but getting the corresponding metrics from the centralized Prometheus doesn't yet.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aantn
add TODO
9fda8be
@aantn

aantn commented Jun 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@deutschj does it work if you provide --prometheus-cluster-key, -l, and -c with -c set to the same value as -l?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aantn added 2 commits July 1, 2024 10:33
@aantn
Fix ArgoRollouts (#308)
f71abd1
@aantn
Prevent single errors from failing scan (#307)
66389e6
Fixes #301
@deutschj

deutschj commented Jul 2, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@aantn Unfortunately not, no - this yields the same error as above, CRITICAL Cannot scan multiple clusters for this prometheus, Rerun with the flag '-c <cluster>' where <cluster> is one of [...]

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Pionerd

Pionerd commented Jul 8, 2024

Copy link
Copy Markdown

Would love to see this merged, using KRR from this feature branch for some time now

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aantn

aantn commented Jul 8, 2024

Copy link
Copy Markdown
Contributor

Hey, we're planning to get it merged, but no exact ETA yet.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wad-hongsumin

wad-hongsumin commented Aug 12, 2024

Copy link
Copy Markdown

hello. Are there any plans for this branch to be merged?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arikalon1

arikalon1 commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

hey @wad-hongsumin

We do plan to merge it, hopefully soon

wad-hongsumin and suminhong reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wad-hongsumin

wad-hongsumin commented Aug 12, 2024

Copy link
Copy Markdown

@arikalon1
thank you. I'm hoping this PR gets merged quickly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@patsevanton

patsevanton commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

is it possible to divide MR into several MR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mysiki mysiki mentioned this pull request Mar 20, 2025
Scan pod alone #415
Open
@ElfoLiNk ElfoLiNk mentioned this pull request Jul 31, 2026
Support OpenTelemetry metrics alongside kube-state-metrics #546
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@arikalon1 arikalon1 arikalon1 left review comments
@aantn aantn Awaiting requested review from aantn

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@LeaveMyYard LeaveMyYard

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@LeaveMyYard @deutschj @aantn @Pionerd @wad-hongsumin @arikalon1 @patsevanton
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.