Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-56831

could create cluster-monitoring-config configmap if prometheusK8s.additionalAlertmanagerConfigs apiVersion is v1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Normal Normal
    • None
    • 4.19.z, 4.20.0
    • Monitoring
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      read discussion in https://github.com/openshift/cluster-monitoring-operator/pull/2591,

      OCP 4.19 will fail early (InvalidConfigXXX) in case alertmanager apiVersion: v1 is still specified in one of the two configmaps.

      checked with 4.19.0-0.nightly-2025-05-27-223016, set prometheusK8s.additionalAlertmanagerConfigs apiVersion to v1, no error throw out

      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: cluster-monitoring-config
        namespace: openshift-monitoring
      data:
        config.yaml: |
          enableUserWorkload: true
          prometheusK8s:
            additionalAlertmanagerConfigs:
            - scheme: http
              apiVersion: v1
              staticConfigs:
              - alertmanager-operated.openshift-user-workload-monitoring.svc:9093

      configmap created

      $ oc -n openshift-monitoring get cm cluster-monitoring-config -oyaml
      apiVersion: v1
      data:
        config.yaml: |
          enableUserWorkload: true
          prometheusK8s:
            additionalAlertmanagerConfigs:
            - scheme: http
              apiVersion: v1
              staticConfigs:
              - alertmanager-operated.openshift-user-workload-monitoring.svc:9093
      kind: ConfigMap
      metadata:
        creationTimestamp: "2025-05-29T02:16:16Z"
        name: cluster-monitoring-config
        namespace: openshift-monitoring
        resourceVersion: "43733" 

      prometheusK8s supports additionalAlertmanagerConfigs

      https://github.com/openshift/cluster-monitoring-operator/blob/release-4.19/pkg/manifests/types.go#L177-L181

      NOTE: no such issue for the UWM prometheus/thanosruler, example

      $ oc apply -f  -<< eof
      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: user-workload-monitoring-config
        namespace: openshift-user-workload-monitoring
      data:
        config.yaml: |-
          prometheus:
            additionalAlertmanagerConfigs:
            - scheme: http
              pathPrefix: /
              timeout: 30s
              apiVersion: v1
              staticConfigs:
              - alertmanager-operated.openshift-user-workload-monitoring.svc:9093
      eof
      Error from server (Forbidden): error when creating "STDIN": admission webhook "monitoringconfigmaps.openshift.io" denied the request: the user workload monitoring configuration in "config.yaml" could not be parsed: alertmanager's apiVersion=v1 is no longer supported, v2 has been available since Alertmanager 0.16.0: found in prometheus.additionalAlertmanagerConfigs 

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

      4.19/4.20    

      How reproducible:

      always

      Steps to Reproduce:

      1. see the description
          

      Actual results:

      could create cluster-monitoring-config configmap if prometheusK8s.additionalAlertmanagerConfigs apiVersion is v1

      Expected results:

      should reject

              jfajersk@redhat.com Jan Fajerski
              juzhao@redhat.com Junqi Zhao
              None
              None
              Junqi Zhao Junqi Zhao
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: