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.
Reassigning to Andy since he is the most knowledgable regarding alerting and implemented the existing code.
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.
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