GoogleCloudPlatform / prometheus-engine

Google Cloud Managed Service for Prometheus libraries and manifests.
https://g.co/cloud/managedprometheus
Apache License 2.0
196 stars 93 forks source link

feat: add rules-evaluator proxy calls to frontend #1162

Closed yama6a closed 1 month ago

yama6a commented 1 month ago

Enabling to query /api/v1/rules and /api/v1/alerts from the frontend by proxying these calls to the rule-evaluator pod.

This PR also creates a k8s service manifest for the rule-evaluator in order to be able to reach it from frontend

Note: There was no proper way to test the k8s manifests in an actual cluster. If there is a way to test this setup properly before merging, that would probably be advisable. Update: Added e2e tests

pintohutch commented 1 month ago

Thanks @yama6a - for e2e testing, see our tests in https://github.com/GoogleCloudPlatform/prometheus-engine/tree/main/e2e.

They deploy a full stack running to a kind cluster and do assertions on the workloads therein. You could add some testing there to double-check the manifests etc

yama6a commented 1 month ago

Thanks @yama6a - for e2e testing, see our tests in main/e2e.

They deploy a full stack running to a kind cluster and do assertions on the workloads therein. You could add some testing there to double-check the manifests etc

@pintohutch Thanks for the pointer. I'll see what I can do 🙂

HThorsell commented 1 month ago

Hi @bwplotka! Im Henrik, colleague of Yama here. We have added to the e2e tests as requested, please have another look at our PR.

yama6a commented 1 month ago

@bwplotka @pintohutch We added an e2e test. We also deployed the changes to the rule-evaluator, the k8s service, and the frontend to a GKE test-cluster and smoke-tested the endpoints. Everything works as expected: rule-evaluator endpoints, the service, and the endpoint-forwarding: frontend-pod -> rule-evaluator-service -> rule-evaluator-pod

We refactored quite a lot in this PR compared to the first commit, improving on the structure and testability of the code, so you might want to re-review.

HThorsell commented 1 month ago

Nice! I had some readability comments... ended up doing a PR to fix this, might be easier. I left the functionality untouched really -- great job!

My recommendations are here yama6a#1

Thank you! Your suggestions have been applied, ready for another round.

HThorsell commented 1 month ago

Ive squashed the commits to comply with the presubmit check for commit message format

bwplotka commented 1 month ago

Thanks! 💪🏽