Bug 2036717 - Valid AlertmanagerConfig custom resource with valid a mute time interval definition is rejected
Summary: Valid AlertmanagerConfig custom resource with valid a mute time interval defi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Monitoring
Version: 4.10
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.10.0
Assignee: Simon Pasquier
QA Contact: Junqi Zhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-03 16:29 UTC by Simon Pasquier
Modified: 2022-03-12 04:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-12 04:40:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-monitoring-operator pull 1525 0 None open Bug 2036717: [bot] Automated jsonnet dependencies update 2022-01-04 09:27:53 UTC
Github openshift cluster-monitoring-operator pull 1526 0 None open Bug 2036717: [bot] Automated dependencies version update 2022-01-04 09:55:50 UTC
Github openshift prometheus-operator pull 147 0 None open Bug 2036717: [bot] Bump openshift/prometheus-operator to v0.53.1 2022-01-03 16:30:42 UTC
Red Hat Product Errata RHSA-2022:0056 0 None None None 2022-03-12 04:40:42 UTC

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


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