Bug 2060718

Summary: prometheus: Add validations for relabel configs
Product: OpenShift Container Platform Reporter: Jayapriya Pai <janantha>
Component: MonitoringAssignee: Jayapriya Pai <janantha>
Status: CLOSED ERRATA QA Contact: Junqi Zhao <juzhao>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.9CC: amuller, anpicker, aos-bugs, erooth, gparente, janantha, juzhao, spasquie
Target Milestone: ---   
Target Release: 4.10.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2051470 Environment:
Last Closed: 2022-03-28 12:03:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2051470    
Bug Blocks:    

Comment 2 Junqi Zhao 2022-03-18 07:03:17 UTC
tested with PR, followed steps in Comment 7/8 of bug 2051470, removed the targetLabel, no error in the prometheus-k8s pod and the servicemonitor is skipped, so it would not loaded to prometheus configuration, and there's error "relabel configuration for replace action needs targetLabel value" in prometheus operator
prometheus-operator 0.53.1

# oc -n openshift-monitoring exec -c prometheus prometheus-k8s-0 -- cat /etc/prometheus/config_out/prometheus.env.yaml | grep "serviceMonitor/openshift-console/console-test/0"
no result

# oc -n openshift-monitoring logs -c prometheus prometheus-k8s-0 | grep "couldn't load configuration"
no result


# oc -n openshift-monitoring logs -c prometheus-operator $(oc -n openshift-monitoring get pod --no-headers | grep prometheus-operator | awk '{print $1}') | grep "relabel configuration for replace action needs targetLabel value"
level=warn ts=2022-03-18T06:44:33.852757829Z caller=operator.go:1832 component=prometheusoperator msg="skipping servicemonitor" error="relabel configuration for replace action needs targetLabel value" servicemonitor=openshift-console/console-test namespace=openshift-monitoring prometheus=k8s
level=warn ts=2022-03-18T06:44:34.326645292Z caller=operator.go:1832 component=prometheusoperator msg="skipping servicemonitor" error="relabel configuration for replace action needs targetLabel value" servicemonitor=openshift-console/console-test namespace=openshift-monitoring prometheus=k8s
level=warn ts=2022-03-18T06:46:50.096559124Z caller=operator.go:1832 component=prometheusoperator msg="skipping servicemonitor" error="relabel configuration for replace action needs targetLabel value" servicemonitor=openshift-console/console-test namespace=openshift-monitoring prometheus=k8s

Comment 8 errata-xmlrpc 2022-03-28 12:03:18 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.10.6 bug fix 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/RHBA-2022:1026