# There is a bug that triggers a TargetDown alert when Prometheus tries to scrape shared-resource-csi-driver-node-metrics service endpoints.
# Root cause is serverName is set to "shared-resource-csi-driver-node-metrics.openshift-cluster-csi-drivers.svc" during the OpenShift Build operator configuration.
# There is not bug issue ticket filed at this time.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: shared-resource-csi-driver-node-monitor
  namespace: openshift-builds
spec:
  endpoints:
    - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
      interval: 30s
      path: /metrics
      port: provisioner-m
      scheme: https
      tlsConfig:
        caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
        serverName: shared-resource-csi-driver-node-metrics.openshift-builds.svc
    - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
      interval: 30s
      path: /metrics
      port: attacher-m
      scheme: https
      tlsConfig:
        caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
        serverName: shared-resource-csi-driver-node-metrics.openshift-builds.svc
    - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
      interval: 30s
      path: /metrics
      port: resizer-m
      scheme: https
      tlsConfig:
        caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
        serverName: shared-resource-csi-driver-node-metrics.openshift-builds.svc
  jobLabel: component
  selector:
    matchLabels:
      app: shared-resource-csi-driver-node-metrics