Bug 2115347

Summary: 03279843 | Sev 3 | Negative regex matchers for alertmanager silences not properly parsed or read by console
Product: OpenShift Container Platform Reporter: David Caldwell <dcaldwel>
Component: Management ConsoleAssignee: Andrew Pickering <anpicker>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, anpicker, igoihman, jcaiani, jhadvig, juzhao
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-17 19:54:14 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:

Description David Caldwell 2022-08-04 13:16:46 UTC
Description of problem:

The web console is not parsing regular expressions containing exclamation marks when creating alertmanager silence rules nor when reading existing silence rules.

No other characters or expressions have been observed to not be parsed properly by the console in this way.

The webconsole URL used: [https://console-openshift-console.apps.ocpxx.cloud.xxxxx.app.domain.com/monitoring/silences?rowFilter-silence-state=active%2Cpending]


How reproducible:

Scenario 1:

Create an alertmanager rule that silences an alert using "!=" regex logic. 

Switch to webconsole and it is changed to "=".

Scenario 2:

Create a rule as above but directly in the webconsole. 

Notice that the rule is not saved with the "!=" expression logic.


Additional info:

Original customer description in private comment.

Please also see private attachment screenshots.

Comment 6 Robb Hamilton 2022-08-15 14:07:42 UTC
Reassigning to Andy since he is the most knowledgable regarding alerting and implemented the existing code.

Comment 12 Junqi Zhao 2022-10-27 06:32:32 UTC
tested with 4.12.0-0.nightly-2022-10-25-210451, "Create silence" page, "Negative matcher" check box is added, tested with comment in Comment 5
sh-4.4$ amtool --alertmanager.url http://localhost:9093 silence add 'alertname!~.*signalilo.*' -a author -c amtooltest -d 2h
ecf60de1-3320-4a97-990f-3eb38e38834d
sh-4.4$ amtool --alertmanager.url http://localhost:9093 alert query
Alertname  Starts At  Summary  State  
sh-4.4$ amtool --alertmanager.url http://localhost:9093 silence query
ID                                    Matchers                    Ends At                  Created By  Comment     
ecf60de1-3320-4a97-990f-3eb38e38834d  alertname!~".*signalilo.*"  2022-10-27 08:15:46 UTC  author      amtooltest  

checked in console page, silence matcher is alertname!~.*signalilo.*, negative regex matcher is properly parsed by console.

Comment 18 errata-xmlrpc 2023-01-17 19:54:14 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.12.0 bug fix and 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:7399