Bug 2046597

Summary: Observe > Targets page may show the wrong service monitor is multiple monitors have the same namespace & label selectors
Product: OpenShift Container Platform Reporter: Andrew Pickering <anpicker>
Component: MonitoringAssignee: Andrew Pickering <anpicker>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.10CC: amuller, anpicker, aos-bugs, erooth
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-12 04:41:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 3 Junqi Zhao 2022-01-28 08:49:09 UTC
tested with the PR, the 2 service monitors have exactly the same namespace selector and label selector, Observe > Targets page now show the correct service monitor, see the picture.
# oc -n ns1 get servicemonitor
NAME                           AGE
prometheus-example-monitor-1   11m
prometheus-example-monitor-2   10m


# oc -n ns1 get servicemonitor prometheus-example-monitor-1 -o jsonpath="{.spec.namespaceSelector}"; echo -e "\n"; oc -n ns1 get servicemonitor prometheus-example-monitor-1 -o jsonpath="{.spec.selector.matchLabels}"
{"matchNames":["ns1"]}

{"app":"prometheus-example-app"}

# oc -n ns1 get servicemonitor prometheus-example-monitor-2 -o jsonpath="{.spec.namespaceSelector}"; echo -e "\n"; oc -n ns1 get servicemonitor prompath="{.spec.selector.matchLabels}"
{"matchNames":["ns1"]}

{"app":"prometheus-example-app"}

Comment 9 errata-xmlrpc 2022-03-12 04:41:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:0056