Bug 2097716 - settings under httpConfig is dropped with AlertmanagerConfig v1beta1
Summary: settings under httpConfig is dropped with AlertmanagerConfig v1beta1
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Monitoring
Version: 4.11
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Simon Pasquier
QA Contact: Junqi Zhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-16 11:41 UTC by Junqi Zhao
Modified: 2022-08-10 11:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-10 11:18:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift prometheus-operator pull 191 0 None open Bug 2097716: pkg/apis/monitoring/v1beta1: fix httpConfig conversion 2022-06-17 13:37:46 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 11:18:38 UTC

Description Junqi Zhao 2022-06-16 11:41:01 UTC
Description of problem:
tested https://issues.redhat.com/browse/MON-2567 with PR
launch 4.11.0-0.nightly-2022-06-15-161625,openshift/cluster-monitoring-operator#1682

create AlertmanagerConfig with v1beta1 version
# oc create -f - << EOF
apiVersion: monitoring.coreos.com/v1beta1
kind: AlertmanagerConfig
metadata:
  name: test-config
  labels:
    alertmanagerConfig: example
spec:
  route:
    groupBy: ['job']
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: webhook
  receivers:
  - name: webhook
    webhookConfigs:
    - url: 'https://example.com'
      sendResolved: true
      httpConfig:
        followRedirects: true
  - name: wechat-example
    wechatConfigs:
    - apiURL: https://wechatserver:8080/
      corpID: wechat-corpid
      apiSecret:
        name: wechat-config
        key: apiSecret
EOF

checked the AlertmanagerConfig file, httpConfig is {}, followRedirects: true is dropped
# oc get AlertmanagerConfig test-config -oyaml
apiVersion: monitoring.coreos.com/v1beta1
kind: AlertmanagerConfig
metadata:
  creationTimestamp: "2022-06-16T11:23:20Z"
  generation: 1
  labels:
    alertmanagerConfig: example
  name: test-config
  namespace: default
  resourceVersion: "45914"
  uid: e9d3c61c-bd6e-4122-afd7-c51e9dcb7d8d
spec:
  receivers:
  - name: webhook
    webhookConfigs:
    - httpConfig: {}
      sendResolved: true
      url: https://example.com
  - name: wechat-example
    wechatConfigs:
    - apiSecret:
        key: apiSecret
        name: wechat-config
      apiURL: https://wechatserver:8080/
      corpID: wechat-corpid
  route:
    groupBy:
    - job
    groupInterval: 5m
    groupWait: 30s
    receiver: webhook
    repeatInterval: 12h

# oc explain AlertmanagerConfig.spec.receivers.webhookConfigs.httpConfig.followRedirects

KIND:     AlertmanagerConfig
VERSION:  monitoring.coreos.com/v1beta1

FIELD:    followRedirects <boolean>

DESCRIPTION:
     FollowRedirects specifies whether the client should follow HTTP 3xx
     redirects.


use the above AlertmanagerConfig sample with v1alpha1 version in 4.11.0-0.nightly-2022-06-15-161625 cluster, no such issue
# oc get AlertmanagerConfig test-config -oyaml
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  creationTimestamp: "2022-06-16T11:23:41Z"
  generation: 1
  labels:
    alertmanagerConfig: example
  name: test-config
  namespace: default
  resourceVersion: "289618"
  uid: 9869fd51-023d-4390-b884-c20d24309458
spec:
  receivers:
  - name: webhook
    webhookConfigs:
    - httpConfig:
        followRedirects: true
      sendResolved: true
      url: https://example.com
  - name: wechat-example
    wechatConfigs:
    - apiSecret:
        key: apiSecret
        name: wechat-config
      apiURL: https://wechatserver:8080/
      corpID: wechat-corpid
  route:
    groupBy:
    - job
    groupInterval: 5m
    groupWait: 30s
    receiver: webhook
    repeatInterval: 12h

Version-Release number of selected component (if applicable):
tested https://issues.redhat.com/browse/MON-2567 with PR
Prometheus Operator version=0.57.0

How reproducible:
always

Steps to Reproduce:
1. see the description
2.
3.

Actual results:
settings under httpConfig is dropped

Expected results:
should not drop

Additional info:

Comment 3 Junqi Zhao 2022-06-22 01:58:40 UTC
tested with 4.11.0-0.nightly-2022-06-21-151125, set more configurations under httpConfig, no lost data in the created AlertmanagerConfig
oc create -f - << EOF
apiVersion: monitoring.coreos.com/v1beta1
kind: AlertmanagerConfig
metadata:
  name: test-config
  namespace: default
  labels:
    alertmanagerConfig: example
spec:
  route:
    groupBy: ['job']
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: webhook
  receivers:
  - name: webhook
    webhookConfigs:
    - url: 'https://example.com'
      sendResolved: true
      httpConfig:
        followRedirects: true
        oauth2:
          clientId:
            secret:
              name: oauth2-credentials
              key: id
          clientSecret:
            name: oauth2-credentials
            key: secret
          tokenUrl: https://example.com/oauth2/token
          scopes:
          - scope3
          - scope4
          endpointParams:
            param3: value3
            param4: value4
  - name: wechat-example
    wechatConfigs:
    - apiURL: https://wechatserver:8080/
      corpID: wechat-corpid
      apiSecret:
        name: wechat-config
        key: apiSecret
EOF

# oc -n default get AlertmanagerConfig test-config -oyaml
apiVersion: monitoring.coreos.com/v1beta1
kind: AlertmanagerConfig
metadata:
  creationTimestamp: "2022-06-22T01:42:31Z"
  generation: 1
  labels:
    alertmanagerConfig: example
  name: test-config
  namespace: default
  resourceVersion: "75025"
  uid: 8abd3bec-e96a-4686-97c4-ef87340b514e
spec:
  receivers:
  - name: webhook
    webhookConfigs:
    - httpConfig:
        followRedirects: true
        oauth2:
          clientId:
            secret:
              key: id
              name: oauth2-credentials
          clientSecret:
            key: secret
            name: oauth2-credentials
          endpointParams:
            param3: value3
            param4: value4
          scopes:
          - scope3
          - scope4
          tokenUrl: https://example.com/oauth2/token
      sendResolved: true
      url: https://example.com
  - name: wechat-example
    wechatConfigs:
    - apiSecret:
        key: apiSecret
        name: wechat-config
      apiURL: https://wechatserver:8080/
      corpID: wechat-corpid
  route:
    groupBy:
    - job
    groupInterval: 5m
    groupWait: 30s
    receiver: webhook
    repeatInterval: 12h

Comment 6 errata-xmlrpc 2022-08-10 11:18:27 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


Note You need to log in before you can comment on or make changes to this bug.