Bug 1805133

Summary: Could create alert receiver with same name from console
Product: OpenShift Container Platform Reporter: Yanping Zhang <yanpzhan>
Component: Management ConsoleAssignee: David Taylor <dtaylor>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: aos-bugs, jcaiani, jokerman
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Multiple Alert Receivers can be created with the same name. Consequence: In the Receiver's table, fields do not match up and deleting one receiver, all receivers with the name are deleted. Fix: In the Create Receiver form, user prompted with an error message if name already exists, and Create button disabled. Result: Users cannot create two receivers with the same name.
Story Points: ---
Clone Of:
: 1807660 (view as bug list) Environment:
Last Closed: 2020-07-13 17:16:20 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:
Bug Depends On:    
Bug Blocks: 1807660    
Attachments:
Description Flags
receivers none

Description Yanping Zhang 2020-02-20 10:38:43 UTC
Created attachment 1664309 [details]
receivers

Description of problem:
Create alert receiver from console, user could create receivers with same name, and routing labels shown on list is a combination of routing labels from all these receivers.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Create slack type alert receiver with name "test1" and routing label "test=one".
2.Create webhook type alert receiver with name "test1" and routing label "new=two"
3.Delete one receiver "test1" by clicking "Delete Receiver" in kebab.

Actual results:
1. Receiver "test1" is created.
2. Another receiver "test1" is created, and routing label for both "test1" receiver are "test=one new=two"
3. All receivers named "test1" are deleted.

Expected results:
2. Not sure if it's legal to have receivers with same name.
3. If receivers with same name could co-exist, should not delete all receivers when delete one of them. 

Additional info:

Comment 1 David Taylor 2020-02-21 14:45:37 UTC
I suggest we wait on implementing a whole bunch of UI/frontend receiver form validations.  The issue is that other k8s yaml is validated via the backend, since the alertmanger.yaml is stored in a Secret, it currently doesn't go through any yaml validation.

There is a JIRA story to investigate an overall alertmanger yaml schema validation strategy:
https://issues.redhat.com/browse/CONSOLE-2048

In the JIRA story, Sam P. mentions: ".. the monitoring guys are probably going to move [alertmanager] to a CRD in 4.5 if they do, we'd have the backend to validate for us so i'd probably hold off on [implementing more frontend validation]".

Comment 2 David Taylor 2020-02-21 16:35:26 UTC
Receiver's names should be unique:

# The unique name of the receiver.
name: <string>

https://prometheus.io/docs/alerting/configuration/#receiver

After some discussions it was determined that this will be fixed in console UI.
We do not know when/if monitoring team will switch alertmanager to a CRD, so until such time console will handle alertmanager.yaml validations.

Comment 5 Yanping Zhang 2020-03-06 07:04:09 UTC
Checked on OCP 4.5 cluster with payload 4.5.0-0.ci-2020-03-04-223611.
Create a alert receiver with name"test", then create another receiver, set name as "test" again, there is prompt info "A receiver with that name already exists.", and "Create" button is disabled.
The bug is fixed, so move it to Verified.

Comment 7 errata-xmlrpc 2020-07-13 17:16:20 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, 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/RHBA-2020:2409