Skip to content

Commit

Permalink
[release-1.4] RHIDP-5592:Wrong definition of Service Monitor for an R…
Browse files Browse the repository at this point in the history
…HDH instance by the Operator (redhat-developer#936)

* fixed merge conflicts

* Incorporated Jessica's comments

* Made a few changes

* Final changes

* Incorporated Lindsey's comments

* Final update

* Incorporated comments

* Incorporated comment

---------

Co-authored-by: Priyanka Abel <[email protected]>
  • Loading branch information
openshift-cherrypick-robot and pabel-rh authored Feb 14, 2025
1 parent 4348341 commit 47f585e
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions modules/observe/proc-admin-enabling-metrics-ocp-operator.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,34 @@ Currently, the {product} Operator does not support creating a `ServiceMonitor` c
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: <custom_resource_name> # <1>
namespace: {my-product-namespace} # <2>
name: _<developer_hub_service_monitor_name>_ <1>
namespace: _<rhdh_namespace_name>_ <2>
labels:
app.kubernetes.io/instance: <custom_resource_name>
app.kubernetes.io/name: backstage
app.kubernetes.io/instance: _<rhdh_cr_name>_ <3>
app.kubernetes.io/name: {product-custom-resource-type}
spec:
namespaceSelector:
matchNames:
- {my-product-namespace}
- _<rhdh_namespace_name>_ <4>
selector:
matchLabels:
rhdh.redhat.com/app: backstage-<custom_resource_name>
app.kubernetes.io/instance: _<deployment_name>_ <5>
app.kubernetes.io/name: _<rhdh_cr_type>_ <6>
endpoints:
- port: http-metrics
path: '/metrics'
----
<1> Replace `<custom_resource_name>` with the name of your `{product-custom-resource-type}` custom resource.
<2> Replace `<project_name>` with the name of the {ocp-short} project where your {product} instance is running.
<1> The name of your `ServiceMonitor` resource, for example, `developer_hub_service_monitor`.
<2> The namespace where your `ServiceMonitor` will live, for example, `{my-product-namespace}`.
<3> The label name identifying the `ServiceMonitor` CR instance, for example, `{my-product-cr-name}`.
<4> The namespace where your {product-very-short} instance is installed, for example, `{my-product-namespace}`.
<5> The name of your {product-very-short} deployment, for example, `developer-hub`.
<6> The name of your {product-very-short} application, for example, `backstage`.
+
[NOTE]
====
`spec.selector.matchLabels` configuration must match the labels of your {product-very-short} installation.
====

. Apply the `ServiceMonitor` CR by running the following command:
+
Expand All @@ -55,3 +65,4 @@ oc apply -f <filename>

. From the *Developer* perspective in the {ocp-short} web console, select the *Observe* view.
. Click the *Metrics* tab to view metrics for {product} pods.
. From the Developer perspective in the {ocp-short} web console, click **Project > Services** and verify the labels for `backstage-developer-hub`.

0 comments on commit 47f585e

Please sign in to comment.