Bug 1857229

Summary: Rules with the "openshift.io/prometheus-rule-evaluation-scope: leaf-prometheus" label shouldn't be deployed on Thanos ruler
Product: OpenShift Container Platform Reporter: Simon Pasquier <spasquie>
Component: MonitoringAssignee: Sergiusz Urbaniak <surbania>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.6CC: alegrand, anpicker, erooth, kakkoyun, lcosic, mloibl, pkrupa, surbania
Target Milestone: ---   
Target Release: 4.6.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: 2020-10-27 16:14:43 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 2020-07-15 13:45:15 UTC
Description of problem:
As stated in the OpenShift enhancement proposal [1], a rule that has the  "openshift.io/prometheus-rule-evaluation-scope: leaf-prometheus" label should be deployed on the user-workload monitoring Prometheus instances instead of Thanos ruler. Currently the rule is deployed on both.

[1] https://github.com/openshift/enhancements/blob/master/enhancements/monitoring/user-workload-monitoring.md

Version-Release number of selected component (if applicable):
4.6 but also exists for 4.5

How reproducible:
Always

Steps to Reproduce:
1. Enable user-workload monitoring
2. Create a namespace named "demo"
3. Deploy this simple rule
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: demo
  namespace: demo
  labels:
    app: demo
    openshift.io/prometheus-rule-evaluation-scope: leaf-prometheus
spec:
  groups:
    - name: demo
      rules:
        - expr: vector(1)
          record: demo

Actual results:
The rule is deployed on prometheus-user-workload-* and thanos-ruler-user-workload-* instances.

Expected results:
The rule is deployed only on prometheus-user-workload-* instances.

Additional info:

Comment 5 Junqi Zhao 2020-08-05 06:17:36 UTC
tested with 4.6.0-0.nightly-2020-08-04-193041, followed the steps in Comment 0, Rules with the "openshift.io/prometheus-rule-evaluation-scope: leaf-prometheus" label only deployed on prometheus-user-workload-* instances.
# oc -n openshift-user-workload-monitoring exec -c rules-configmap-reloader thanos-ruler-user-workload-0 -- ls /etc/thanos/rules/thanos-ruler-user-workload-rulefiles-0
no result

# oc -n openshift-user-workload-monitoring exec -c rules-configmap-reloader prometheus-user-workload-0 -- ls /etc/prometheus/rules/prometheus-user-workload-rulefiles-0
demo-demo.yaml

Comment 7 errata-xmlrpc 2020-10-27 16:14:43 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 (OpenShift Container Platform 4.6 GA Images), 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:4196