apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: kube-apiserver-operator
  namespace: openshift-kube-apiserver-operator
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
spec:
  endpoints:
  - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
    interval: 30s
    metricRelabelings:
    - action: drop
      regex: etcd_(debugging|disk|request|server).*
      sourceLabels:
      - __name__
    port: https
    scheme: https
    tlsConfig:
      caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
      serverName: metrics.openshift-kube-apiserver-operator.svc
  jobLabel: component
  namespaceSelector:
    matchNames:
    - openshift-kube-apiserver-operator
  selector:
    matchLabels:
      app: kube-apiserver-operator
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: kube-apiserver-operator
  namespace: openshift-kube-apiserver-operator
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
spec:
  groups:
  - name: cluster-version
    rules:
    - alert: TechPreviewNoUpgrade
      annotations:
        message: Cluster has enabled tech preview features that will prevent upgrades.
      expr: |
        cluster_feature_set{name!="", namespace="openshift-kube-apiserver-operator"} == 0
      for: 10m
      labels:
        severity: warning
