Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2036717

Summary: Valid AlertmanagerConfig custom resource with valid a mute time interval definition is rejected
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.10CC: amuller, anpicker, aos-bugs, erooth
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-12 04:40:32 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-01-03 16:29:37 UTC
Description of problem:
A valid AlertmanagerConfig resource referring to the 'february' month can't be created because the OpenAPI spec of the CRD has a typo.  

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

How reproducible:
Always

Steps to Reproduce:
1. Run the following command

cat <<EOF | oc apply -f -
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: example
spec:
  route:
    groupBy: ['job']
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'null'
    muteTimeIntervals:
    - feb
  muteTimeIntervals:
  - name: feb
    timeIntervals:
    - months:
      - february
  receivers:
  - name: 'null'
EOF

Actual results:

The command fails with the following message:

The AlertmanagerConfig "example" is invalid: spec.muteTimeIntervals.timeIntervals.months: Invalid value: "february": spec.muteTimeIntervals.timeIntervals.months in body should match '^((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12])(?:((:((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12]))$)|$)'


Expected results:
No error

Comment 1 Junqi Zhao 2022-01-04 03:48:30 UTC
tested with the PR, still see the error, prometheus-operator version is 0.53.1, but prometheus-operator resource version label is still 0.53.0
# oc -n openshift-monitoring logs prometheus-operator-58dfffc4c6-8qhpg | head
level=info ts=2022-01-04T02:06:21.031156379Z caller=main.go:217 msg="Starting Prometheus Operator" version="(version=0.53.1, branch=master, revision=f09f225f4)"
...

# cat <<EOF | oc apply -f -
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
  name: example
spec:
  route:
    groupBy: ['job']
    groupWait: 30s
    groupInterval: 5m
    repeatInterval: 12h
    receiver: 'null'
    muteTimeIntervals:
    - feb
  muteTimeIntervals:
  - name: feb
    timeIntervals:
    - months:
      - february
  receivers:
  - name: 'null'
EOF
The AlertmanagerConfig "example" is invalid: spec.muteTimeIntervals.timeIntervals.months: Invalid value: "february": spec.muteTimeIntervals.timeIntervals.months in body should match '^((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12])(?:((:((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12]))$)|$)'

# oc -n openshift-monitoring get deploy prometheus-operator -oyaml
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2022-01-04T02:06:15Z"
  generation: 1
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/managed-by: cluster-monitoring-operator
    app.kubernetes.io/name: prometheus-operator
    app.kubernetes.io/part-of: openshift-monitoring
    app.kubernetes.io/version: 0.53.0
  name: prometheus-operator
  namespace: openshift-monitoring
  resourceVersion: "7338"
  uid: da1d4562-118f-47ff-b647-b63b25a86f9e
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/component: controller
      app.kubernetes.io/name: prometheus-operator
      app.kubernetes.io/part-of: openshift-monitoring
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: prometheus-operator
        target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      creationTimestamp: null
      labels:
        app.kubernetes.io/component: controller
        app.kubernetes.io/managed-by: cluster-monitoring-operator
        app.kubernetes.io/name: prometheus-operator
        app.kubernetes.io/part-of: openshift-monitoring
        app.kubernetes.io/version: 0.53.0

Comment 2 Junqi Zhao 2022-01-04 03:54:31 UTC
# oc get crd alertmanagerconfigs.monitoring.coreos.com -oyaml
...
                          months:
                            description: Months is a list of MonthRange
                            items:
                              description: MonthRange is an inclusive range of months
                                of the year beginning in January Months can be specified
                                by name (e.g 'January') by numerical month (e.g '1')
                                or as an inclusive range (e.g 'January:March', '1:3',
                                '1:March')
                              pattern: ^((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12])(?:((:((?i)january|febuary|march|april|may|june|july|august|september|october|november|december|[1-12]))$)|$)
                              type: string
                            type: array

Comment 3 Junqi Zhao 2022-01-04 11:30:50 UTC
tested with above PRs, followed steps in Comment 0, no error now
# oc -n openshift-monitoring logs prometheus-operator-65f7676954-j8tsc | head
level=info ts=2022-01-04T10:55:29.204254018Z caller=main.go:217 msg="Starting Prometheus Operator" version="(version=0.53.1, branch=master, revision=f176cb1ac)"

# oc get crd alertmanagerconfigs.monitoring.coreos.com -oyaml
...
                          months:
                            description: Months is a list of MonthRange
                            items:
                              description: MonthRange is an inclusive range of months
                                of the year beginning in January Months can be specified
                                by name (e.g 'January') by numerical month (e.g '1')
                                or as an inclusive range (e.g 'January:March', '1:3',
                                '1:March')
                              pattern: ^((?i)january|february|march|april|may|june|july|august|september|october|november|december|[1-12])(?:((:((?i)january|february|march|april|may|june|july|august|september|october|november|december|[1-12]))$)|$)
                              type: string
                            type: array

prometheus-operator-65f7676954-j8tsc           2/2     Running   0             29m   app.kubernetes.io/component=controller,app.kubernetes.io/managed-by=cluster-monitoring-operator,app.kubernetes.io/name=prometheus-operator,app.kubernetes.io/part-of=openshift-monitoring,app.kubernetes.io/version=0.53.1,pod-template-hash=65f7676954

Comment 8 errata-xmlrpc 2022-03-12 04:40:32 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 (Moderate: OpenShift Container Platform 4.10.3 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:0056