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 PodMonitors to configure Prometheus how to monitor Redis and Sentinel pods #624

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

hashemi-soroush
Copy link
Contributor

Fixes #383 , #494 and #623 .

Changes proposed on the PR:

  • Adds PodMonitor config field to Exporter in the RedisFailover CRD
  • Adds generators for PodMonitor CRs according to RedisFailover CR
  • Adds ensurers for PodMonitor CRs
  • Adds PodMonitor Kubernetes client

@ebuildy
Copy link
Contributor

ebuildy commented Jun 29, 2023

Really wonderful! Do you need any help to finish it?

@hashemi-soroush
Copy link
Contributor Author

Really wonderful! Do you need any help to finish it?

Thanks for the offer. I've tested it on production and it works well. Still, if you have the time, I'd appreciate it if you could review and test it. All comments are welcome.

Also, I've implemented this to resolve the issues mentioned in the PR. If you have similar use cases, please share it in #623 . So we can discuss them and hopefully extend this PR.

@EsDmitrii
Copy link
Contributor

Hi!
What about this PR?
This is awesome feature, we need this:)

Copy link
Member

@ese ese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a couple of comments

@@ -13,10 +13,26 @@ func (w *RedisFailoverHandler) Ensure(rf *redisfailoverv1.RedisFailover, labels
if err := w.rfService.EnsureRedisService(rf, labels, or); err != nil {
return err
}
if err := w.rfService.EnsureRedisPodMonitor(rf, labels, or); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail for deployments that have enabled the exporter but not podmonitor CRD. I think we should only ensure pod monitor when it has been defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I will fix it.

}

if rf.Spec.Sentinel.Exporter.Enabled {
if err := w.rfService.EnsureSentinelPodMonitor(rf, labels, or); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail for deployments that have enabled the exporter but not podmonitor CRD. I think we should only ensure pod monitor when it has been defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Will fix it.

@lord-kyron
Copy link

@hashemi-soroush were you able to fix those lastly mentioned problems?
I want to merge this PR into our forked repo for this project, but want to make sure those are fixed.

@hashemi-soroush
Copy link
Contributor Author

Hey @lord-kyron,
Unfortunately no.
I was working on this PR in my previous company. We were blocked for a while waiting for a code review from the owners, so my team's priorities changed. Soon after, I left the company. Now, I don't have access to a production grade Kubernetes infrastructure. I might be able to fix the issues mentioned in the comments, but I can't test it in a production grade environment. If you can test it, maybe we can finally finish this PR.

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 this pull request may close these issues.

Add support for creating PodMonitor or ServiceMonitor
5 participants