Add scrapeconfig discovery for InstanceHA metrics#902
Conversation
Discover InstanceHA metrics services using label selectors (metrics=enabled, service=instanceha) and automatically generate a Prometheus ScrapeConfig for them, following the existing OVN pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This change depends on a change that failed to merge. Change openstack-k8s-operators/infra-operator#590 is needed. |
|
recheck |
|
tested by creating instanceha/instanceha-0: verifying the service was created and the scrapeconfig after that: tested querying metrics using: |
|
This change depends on a change that failed to merge. Change openstack-k8s-operators/infra-operator#590 is needed. |
|
recheck |
|
This change depends on a change that failed to merge. Change openstack-k8s-operators/infra-operator#590 is needed. |
|
recheck |
|
This change depends on a change that failed to merge. Change openstack-k8s-operators/infra-operator#590 is needed. |
|
recheck |
| if labels := o.GetLabels(); labels != nil { | ||
| if labels["metrics"] == "enabled" && (labels["service"] == "ovn-northd" || labels["service"] == "ovn-controller-metrics" || labels["service"] == "ovsdbserver-nb" || labels["service"] == "ovsdbserver-sb") { | ||
| // get all metricstorage CRs in the same namespace | ||
| if labels["metrics"] == "enabled" && (labels["service"] == "ovn-northd" || labels["service"] == "ovn-controller-metrics" || labels["service"] == "ovsdbserver-nb" || labels["service"] == "ovsdbserver-sb" || labels["service"] == "instanceha") { |
There was a problem hiding this comment.
Is there anything against leaving this just with "if labels["metrics"]" instead of having to maintain a (maybe) growing list of services that do not offer too much advantages
There was a problem hiding this comment.
you tell me :) I just didn't want to abstract this too much and I thought it could prevent some "rogue" service running in the same namespace from getting a scrapeconfig when it shouldn't.
There was a problem hiding this comment.
Yeah, lets leave this pattern for now and we can remove the labels maybe in a subsequent patch
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jlarriba, lmiccini The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
559979f
into
openstack-k8s-operators:main
Discover InstanceHA metrics services using label selectors (metrics=enabled, service=instanceha) and automatically generate a Prometheus ScrapeConfig for them, following the existing OVN pattern.
Depends-on: openstack-k8s-operators/infra-operator#590