Bug 1827648 - monitoring-rules-edit role can't edit PrometheusRules resources
Summary: monitoring-rules-edit role can't edit PrometheusRules resources
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Monitoring
Version: 4.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.5.0
Assignee: Simon Pasquier
QA Contact: Junqi Zhao
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-24 12:41 UTC by Simon Pasquier
Modified: 2020-07-13 17:31 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-13 17:31:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-monitoring-operator pull 767 0 None closed Bug 1827648: fix monitoring-rules-edit and monitoring-edit roles 2020-11-11 13:49:55 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:31:42 UTC

Description Simon Pasquier 2020-04-24 12:41:28 UTC
Description of problem:
A user with the monitoring-rules-edit role should be able to edit PrometheusRules resources.

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

How reproducible:
Always

Steps to Reproduce:
1. Create a user and bind this user to the monitoring-rules-edit role for the openshift-monitoring namesapce.
oc adm policy add-role-to-user -n openshift-monitoring monitoring-rules-edit simon
2. Login as the new user.
3. Create a PrometheusRules resource in the openshift-monitoring namespace.
cat <<EOF | oc apply -f -
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: test
  namespace: openshift-monitoring
spec:
  groups:
  - name: test
    rules:
    - expr: 1
      record: test
EOF
3. Run "oc -n openshift-monitoring edit prometheusrules test" and edit the "expr" field (changing it to 0 for instance).

Actual results:
error: prometheusrules.monitoring.coreos.com "test" could not be patched: prometheusrules.monitoring.coreos.com "test" is forbidden: User "simon" cannot patch resource "prometheusrules" in A
PI group "monitoring.coreos.com" in the namespace "openshift-monitoring"
You can run `oc replace -f /tmp/oc-edit-e95x8.yaml` to try this update again.

Expected results:
No error.

Additional info:

Comment 3 Junqi Zhao 2020-04-28 03:15:14 UTC
Tested with 4.5.0-0.nightly-2020-04-27-192810, monitoring-rules-edit and monitoring-edit can update resources 
$ oc -n test edit prometheusrule/watchdog.rules
prometheusrule.monitoring.coreos.com/watchdog.rules edited

$ oc -n test edit ServiceMonitor new-servicemonitor
servicemonitor.monitoring.coreos.com/new-servicemonitor edited

$ oc -n test edit PodMonitor new-podmonitor
podmonitor.monitoring.coreos.com/new-podmonitor edited

Comment 4 errata-xmlrpc 2020-07-13 17:31:25 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, 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/RHBA-2020:2409


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