'ServiceMonitors discovery (Label Selector and Namespace Selector) in Prometheus CR specification

Can somebody explain to me what is logic, or how should i proceed with following problem. I have Prometheus CR with following ServiceMonitor selector.

Name:         k8s
Namespace:    monitoring
Labels:       prometheus=k8s
Annotations:  <none>
API Version:  monitoring.coreos.com/v1
Kind:         Prometheus
...
  Service Monitor Namespace Selector:
  Service Monitor Selector:
...

Prometheus is capable of discovering all serviceMonitors it created, but it does not discover mine (newly created). Is the upper code supposed to match everything, or do you know about how to accomplish this (that is to match every single ServiceMonitor) ?

example of mine ServiceMonitor

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: example-app
  namespace: monitoring
  labels:
    # release: prometheus
    # team: frontend
spec:
  selector:
    matchLabels:
      app: example-app
  namespaceSelector:
    # matchNames:
    # - default
    matchNames:
    - e
  endpoints:
  - port: web

Rest of details

I know that i can discover it with something like this but this would require change in all of other monitors.

  serviceMonitorSelector:
    matchLabels:
      team: frontend

I don't want install Prometheus operator using helm, so instead I installed it from https://github.com/prometheus-operator/kube-prometheus#warning.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source