Bug 2100312 - should use the same value for AlertRelabelConfig with oc explain
Summary: should use the same value for AlertRelabelConfig with oc explain
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Monitoring
Version: 4.11
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.12.0
Assignee: Jan Fajerski
QA Contact: Junqi Zhao
Brian Burt
URL:
Whiteboard:
Depends On:
Blocks: 2111345
TreeView+ depends on / blocked
 
Reported: 2022-06-23 03:05 UTC by Junqi Zhao
Modified: 2023-01-17 19:50 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-17 19:50:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift api pull 1227 0 None open Bug 2100312: monitoring: include lowercase action in relabel_config validation 2022-07-12 15:41:45 UTC
Github openshift cluster-monitoring-operator pull 1740 0 None open Bug 2100312: go.mod: update openshift-api to current release-4.12 tip 2022-08-10 10:26:52 UTC
Red Hat Product Errata RHSA-2022:7399 0 None None None 2023-01-17 19:50:45 UTC

Description Junqi Zhao 2022-06-23 03:05:43 UTC
Description of problem:
tested https://issues.redhat.com/browse/MON-2091 with PR
launch 4.11.0-0.nightly-2022-06-22-190830,openshift/cluster-monitoring-operator#1676 aws

# oc create -f - << EOF
apiVersion: monitoring.openshift.io/v1alpha1
kind: AlertRelabelConfig
metadata:
  name: watchdog
  namespace: openshift-monitoring
spec:
  configs:
  - sourceLabels: [alertname, severity]
    regex: "Watchdog;none"
    targetLabel: severity
    replacement: critical
    action: replace
EOF
The AlertRelabelConfig "watchdog" is invalid: spec.configs[0].action: Unsupported value: "replace": supported values: "Replace", "Keep", "Drop", "HashMod", "LabelMap", "LabelDrop", "LabelKeep"

but from oc explian, replace is a valid value(other values are keep, drop, hashmod, labelmap, labeldrop, or labelkeep, which are lowercase), but the error reports supported values are capitalized: "Replace", "Keep", "Drop", "HashMod", "LabelMap", "LabelDrop", "LabelKeep".
I think we should use the same value for AlertRelabelConfig.

# oc explain AlertRelabelConfig.spec.configs.action
KIND:     AlertRelabelConfig
VERSION:  monitoring.openshift.io/v1alpha1

FIELD:    action <string>

DESCRIPTION:
     action to perform based on regex matching. Must be one of: replace, keep,
     drop, hashmod, labelmap, labeldrop, or labelkeep. Default is: 'replace'

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

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 9 Junqi Zhao 2022-08-15 06:40:32 UTC
tested with 4.12.0-0.nightly-2022-08-12-053438, we still can not use lowercase action, but from the error logs, the supported values are the same with "oc explain AlertRelabelConfig.spec.configs.action", they are capitalized, is it expected? the tile for PR https://github.com/openshift/api/pull/1227 is wrong, it should be "exclude lowercase action in relabel_config validation", not include

# oc create -f - << EOF
apiVersion: monitoring.openshift.io/v1alpha1
kind: AlertRelabelConfig
metadata:
  name: watchdog
  namespace: openshift-monitoring
spec:
  configs:
  - sourceLabels: [alertname, severity]
    regex: "Watchdog;none"
    targetLabel: severity
    replacement: critical
    action: replace
EOF
The AlertRelabelConfig "watchdog" is invalid: spec.configs[0].action: Unsupported value: "replace": supported values: "Replace", "Keep", "Drop", "HashMod", "LabelMap", "LabelDrop", "LabelKeep"

# oc get crd alertrelabelconfigs.monitoring.openshift.io -oyaml 
...
                  properties:
                    action:
                      default: Replace
                      description: 'action to perform based on regex matching. Must
                        be one of: Replace, Keep, Drop, HashMod, LabelMap, LabelDrop,
                        or LabelKeep.  Default is: ''Replace'''
                      enum:
                      - Replace
                      - Keep
                      - Drop
                      - HashMod
                      - LabelMap
                      - LabelDrop
...

# oc explain AlertRelabelConfig.spec.configs.action
KIND:     AlertRelabelConfig
VERSION:  monitoring.openshift.io/v1alpha1

FIELD:    action <string>

DESCRIPTION:
     action to perform based on regex matching. Must be one of: Replace, Keep,
     Drop, HashMod, LabelMap, LabelDrop, or LabelKeep. Default is: 'Replace'

Comment 10 Jan Fajerski 2022-08-15 06:53:02 UTC
Yes that is expected, please see Joel review: https://github.com/openshift/api/pull/1227#discussion_r929888681

I'll change the PR title accordingly, good catch!

Comment 11 Junqi Zhao 2022-08-15 07:39:17 UTC
based on Comment 9 and Comment 10, set it to verified

Comment 14 errata-xmlrpc 2023-01-17 19:50:29 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.12.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:7399


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