Fix issue with head pod not monitered by Prometheus under certain condition #963
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.
Why are these changes needed?
KubeRay is anticipated to provide a Prometheus metrics endpoint on port 8080.
However, if users specify alternative ports in Spec.HeadGroupSpec.Template.Spec.Containers[ray_index].Ports without setting the metrics port, the head service will exclude the default metrics port. As a result, the service monitor will be unable to scrape metrics. Refer to the following code snippet for the existing logic.
kuberay/ray-operator/controllers/ray/common/service.go
Lines 158 to 163 in 6490749
This can be reproduced by using any sample yaml files, for example, running:
Related issue number
Checks
After this PR, ray-workers-monitor and ray-head-monitor are all set.
![image](https://user-images.githubusercontent.com/51814063/225431206-eac1b788-0f06-4ffe-8f7f-b18b82e8c198.png)