Bug 2091595

Summary: Alertmanager configuration can't use OpsGenie's entity field when AlertmanagerConfig is enabled
Product: OpenShift Container Platform Reporter: Simon Pasquier <spasquie>
Component: MonitoringAssignee: Simon Pasquier <spasquie>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: low Docs Contact:
Priority: medium    
Version: 4.11CC: amuller, anpicker
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 11:14:45 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 Simon Pasquier 2022-05-30 12:32:20 UTC
Description of problem:
When 

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

How reproducible:
Always

Steps to Reproduce:
1. Enable user-defined AlertmanagerConfig in CMO config
kind: ConfigMap
apiVersion: v1
metadata:
  name: cluster-monitoring-config
  namespace: openshift-monitoring
data:
  config.yaml: |-
    alertmanagerMain:
      enableUserAlertmanagerConfig: true
2. Edit the alertmanager-main secret in the openshift-monitoring namespace with an OpsGenie receiver using the new entity field
receivers:
- name: opsgenie
  opsgenie_configs:
  - api_key: foo
    entity: bar
route:
  receiver: "opsgenie"


Actual results:
The PrometheusOperatorReconcileErrors alert is pending and there are errors in the prometheus-operator logs:

level=error ts=2022-05-30T12:29:27.451003887Z caller=klog.go:116 component=k8s_client_runtime func=ErrorDepth msg="Sync \"openshift-monitoring/main\" failed: provision alertmanager configuration: base config from Secret could not be parsed: yaml: unmarshal errors:\n line 32: field entity not found in type config.plain"


Expected results:
No error

Additional info:
The error doesn't happen when enableUserAlertmanagerConfig isn't true.

Comment 2 Simon Pasquier 2022-06-01 13:30:58 UTC
The change had to be reverted.

Comment 6 Junqi Zhao 2022-06-06 10:00:10 UTC
verified with 4.11.0-0.nightly-2022-06-04-014713, followed the steps in comment 0, no PrometheusOperatorReconcileErrors alert and no errors in the prometheus-operator logs.
# oc -n openshift-monitoring get secret alertmanager-main -o jsonpath="{.data.alertmanager\.yaml}" | base64 -d
"global":
  "resolve_timeout": "5m"
"receivers":
- name: opsgenie
  opsgenie_configs:
  - api_key: foo
    entity: bar
route:
  receiver: "opsgenie"

# oc -n openshift-monitoring logs -c prometheus-operator prometheus-operator-646b99c978-hmlh7 | grep "field entity not found in type"
no result

find other issues, tracked in bug 2093892

Comment 10 errata-xmlrpc 2022-08-10 11:14:45 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 (Important: OpenShift Container Platform 4.11.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:5069